473,749 Members | 2,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TransactionScop e MSDTC has been disabled error only on 2nd ExecRea

Hi,

I'm using TransactionScop e to do a serie Insert, Update, Delete operations
with the ExecuteNonQuery and some Selects with ExecuteScalar everything works
fine with multiple connections in the same scope.
Problem is that when i do two Selects with ExecuteReader (to fill datasets)
it shows the folowing error:
>Exception:
Network access for Distributed Transaction Manager (MSDTC) has been
disabled. Please enable DTC for network access in the security configuration
for MSDTC using the Component Services Administrative tool.
>InnerException :
The transaction manager has disabled its support for remote/network
transactions.

Im'm working with SQL2005 and .net3.5
Mar 12 '08 #1
6 3044
So something is causing the LTM to escalate to DTC; this isn't unusual
(although SQL2005 supports promotable transactions for many scenarios), and
will require DTC to be enabled with visibility to/from the db servers
(bidirectional) .

Are the two commands using the same (identical) connection string? Of
course, if you can close the connection it might be able to re-use the
physical connection from the pool. If you are *already* trying to use the
same connection, is MARS enabled?

Marc
Mar 12 '08 #2
Are the two commands using the same (identical) connection string? Yes.
If you are *already* trying to use the same connection, is MARS enabled? I
am, but do know nothing about MARS... Could you explain?

Thanks Marc

"Marc Gravell" wrote:
So something is causing the LTM to escalate to DTC; this isn't unusual
(although SQL2005 supports promotable transactions for many scenarios), and
will require DTC to be enabled with visibility to/from the db servers
(bidirectional) .

Are the two commands using the same (identical) connection string? Of
course, if you can close the connection it might be able to re-use the
physical connection from the pool. If you are *already* trying to use the
same connection, is MARS enabled?

Marc
Mar 12 '08 #3
MARS is Multiple Active Result Sets, and allows for 2 or more active queries
on the same connection (within limits). Of course, if you can serialize your
requests life is easier...
You enable MARS by including "MultipleActive ResultSets=True " in your
connection string.
Anyways, it looks like this might have raised a different error, so maybe
enabling DTC is your best bet...
http://msdn2.microsoft.com/en-us/library/ms345109.aspx

Marc
Mar 12 '08 #4
You are right after enabling inabound and outbound Transaction Manager
Comunication, it works.

Still i can't understand why only the readers go to DTS. I mean i use the
same transactionScop e for several ExecuteNonQuery s and it doesn't need DTS,
it should right?

"Marc Gravell" wrote:
MARS is Multiple Active Result Sets, and allows for 2 or more active queries
on the same connection (within limits). Of course, if you can serialize your
requests life is easier...
You enable MARS by including "MultipleActive ResultSets=True " in your
connection string.
Anyways, it looks like this might have raised a different error, so maybe
enabling DTC is your best bet...
http://msdn2.microsoft.com/en-us/library/ms345109.aspx

Marc
Mar 12 '08 #5
Are you perhaps leaving your readers open? It is unfortunately quite hard to
tell without some code... I'll try and run a few tests later to see if I can
figure anything out...

Marc
Mar 12 '08 #6
No i do not leave the readers open.

The code is like this:
//the connectionstrin g is always the same
private IDataReader dataBaseReader;

function:
using (TransactionSco pe ts = new TransactionScop e())
{
//READ
if (dataBaseReader != null && !dataBaseReader .IsClosed)
dataBaseReader. Close();
if (dataBaseConnec tion.State != ConnectionState .Open)
{
dataBaseConnect ion.ConnectionS tring = connectionStrin g;
dataBaseConnect ion.Open();
}
command.Connect ion = dataBaseConnect ion; //Goes to remote DBServer
dataBaseReader = command.Execute Reader(
CommandBehavior .CloseConnectio n);
dt.Table[0].Load(dataBaseR eader, LoadOption.Upse rt);
dataBaseReader. Close();

//INSERT
if (dataBaseReader != null && !dataBaseReader .IsClosed)
dataBaseReader. Close();
if (dataBaseConnec tion.State != ConnectionState .Open)
{
dataBaseConnect ion.ConnectionS tring = connectionStrin g;
dataBaseConnect ion.Open();
}
command.Connect ion = dataBaseConnect ion;
int rowsAffected = command.Execute NonQuery();

if (dataBaseReader != null && !dataBaseReader .IsClosed)
dataBaseReader. Close();
if (dataBaseConnec tion.State != ConnectionState .Open)
{
dataBaseConnect ion.ConnectionS tring = connectionStrin g;
dataBaseConnect ion.Open();
}
command.Connect ion = dataBaseConnect ion;
object result = command.Execute Scalar();
//READ
if (dataBaseReader != null && !dataBaseReader .IsClosed)
dataBaseReader. Close();
if (dataBaseConnec tion.State != ConnectionState .Open)
{
dataBaseConnect ion.ConnectionS tring = connectionStrin g;

///EXCEPTION!!!
dataBaseConnect ion.Open();
///EXCEPTION!!!

}
command.Connect ion = dataBaseConnect ion; //Goes to remote DBServer
dataBaseReader = command.Execute Reader(
CommandBehavior .CloseConnectio n);
dt.Table[0].Load(dataBaseR eader, LoadOption.Upse rt);
dataBaseReader. Close();
}
Thank for everything you have been very helpful.
"Marc Gravell" wrote:
Are you perhaps leaving your readers open? It is unfortunately quite hard to
tell without some code... I'll try and run a few tests later to see if I can
figure anything out...

Marc
Mar 12 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2055
by: Rick_Kierner | last post by:
I am attempting to use the TransactionScope class to manage my transactions. I am running into an issue. My web server is in an NT work group. My SQL Server is in a domain. When my code attempts to execute the Complete method of the TransactionScope object, I get the following error: "The transaction has already been implicitly or explicitly committed or aborted" I have tried altering the registry entry to...
6
13969
by: cylt | last post by:
Hello, I'm using a TransactionScope with a ADO.NET SqlClient and i get the error : System.Runtime.InteropServices.COMException (0x8004D024): The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024). Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool. I've checked the configuration on both the client...
2
2552
by: Spottswoode | last post by:
Hi I have developed a client/server application in C# that worked perfectly in my office but not so perfectly after deploying it to our client. A little information about the architecture first: Both the client and server components are written in c#, windows forms for the front-end and the back end is exposed through IIS using webservices. We are using Impersonate in the web.config. The application is a warehouse inventory system,...
4
5555
by: hardieca | last post by:
Hi, I'd really like to use TransactionScope within the Business Layer of my web application. A book I'm reading makes a note that it should not be used in a shared web hosting environment because the server may get re-configured. Can anyone elaborate on this? Regards, Chris
4
2048
by: Bexm | last post by:
Hello I am having problems with the transactionscope that is around alot of the code I have it working fine on our local machines and our Dev server, but when we put it on our live server we get this error: "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" The SQL 2005 DB is on the same server, and there is no firewall running and I have set all the setting the same in component services! I know when the DB...
3
8026
by: Aleksey Timonin | last post by:
Hi guys, I tried to use TransactionScope on to defferent TableAdapters like this: using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required)) { TableAdapter1.InsertQuery(id, name); TableAdapter2.InsertQuery(id, customerName, customerAddress); transScope.Complete(); }
3
2896
by: Michael Schöller | last post by:
Hello, First of all english is not my natural language so please fogive me some bad mistakes in gramatic and use of some vocables :). I have a great problem here. Well I will not use it anymore but I want to know why it is as it is ^^. I tried with .NET3.0 but I think it will be the same with 2.0 and 3.5. MSDTC is configured and working.
2
2635
by: GaryDean | last post by:
When I use transactions with sql server I usually do this... using (TransactionScope scope = new TransactionScope) { using (SqlConnection1 = new SqlConnection . . . . . and this all works great. But now, I need to stretch the transaction across to sql databases using two different connections i.e. using (TransactionScope scope = new TransactionScope) {
2
4154
by: G.S. | last post by:
Is there a way to use transactions from within C# code without using MSDTC (client-and-server environment where the SQL server is behind a firewall)? Thank you
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.