473,837 Members | 1,677 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 3048
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
13973
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
2553
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
5566
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
2051
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
8034
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
2902
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
2637
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
4165
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
9696
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10902
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
10583
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9420
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...
0
5680
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4481
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
4062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.