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.
RSS
Has anyone found a work-around other than the lousy passing around one open connection object to all the calling methods in order to keep the TransactionScope Light? I thought the whole point of distributed transaction was so that the DTC could handle that
for you right?
Error on secondNetwork 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
public static Student GetStudent_TestTransactionScopeID(System.Int32 UserID)
{
using(TransactionScope ts = new TransactionScope(TransactionScopeOption.Suppress))
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDBConnection1"].ConnectionString))
{
string commandText = "select FirstName, LastName FROM chUser WHERE UserID = @UserID";
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(commandText, conn);
cmd.Parameters.AddWithValue("@UserID", UserID);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw;
}
}
Database db = DatabaseFactory.CreateDatabase("MyDBConnection1");
using (DbCommand cmd = db.GetSqlStringCommand(@"
SELECT UserID, UserName, Password, EmailAddress
FROM chUsers
WHERE UserID = @UserID
"))
try
{
db.AddInParameter(cmd, "@UserID", System.Data.DbType.Int32, UserID);
using (IDataReader reader = db.ExecuteReader(cmd))
{
if (reader.Read())
{
User newUserID = new UserID();
newUserID.LoadFromDataReader(reader);
return UserID;
}
}
}
catch (Exception ex)
{
throw;
}
return null;
ts.Complete();
}
}
}
3.Right click on My Computer, choose “Properties”, and check if the MSDTC works.
I am having this same problem. What do you mean by see if the MSDTC works? Can you be more specific? I am unsure as to what options to set in order to get the service to run.
I had a very similar problem. I was adding several rows to different tables within a transaction using LINQ. Within the transaction scope I was calling a function which accessed the SQL server (not even the same database, but the same SQL server). When I
attempted to execute the transaction I got the same error you are getting. I moved the code that accessed the database outside the transaction scope so that I retrieved the value to a local variable, and, voila!!, the error went away.
I had a very similar problem. I was adding several rows to different tables within a transaction using LINQ. Within the transaction scope I was calling a function which accessed the SQL server (not even the same database, but the same SQL server). When I
attempted to execute the transaction I got the same error you are getting. I moved the code that accessed the database outside the transaction scope so that I retrieved the value to a local variable, and, voila!!, the error went away.
Its not a good idea to keep MSDTC open assuming firewall team will not be happy. Look out for articles in net for the same. TransactionScope will throw this error if multiple connections are being opened within it.
Your health affects all you do. The key to good health is to eat right, sleep right, exercise right, and treat others right.
dba123
Contributor
2726 Points
1364 Posts
Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC f...
Oct 22, 2007 03:29 AM|LINK
Has anyone found a work-around other than the lousy passing around one open connection object to all the calling methods in order to keep the TransactionScope Light? I thought the whole point of distributed transaction was so that the DTC could handle that for you right?
http://kjellsj.blogspot.com/2006/04/systemtransactions-nesting-scopes.html
so here's my method, I get this error:
Error on secondNetwork 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
public static Student GetStudent_TestTransactionScopeID(System.Int32 UserID) { using(TransactionScope ts = new TransactionScope(TransactionScopeOption.Suppress)) { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDBConnection1"].ConnectionString)) { string commandText = "select FirstName, LastName FROM chUser WHERE UserID = @UserID"; try { conn.Open(); SqlCommand cmd = new SqlCommand(commandText, conn); cmd.Parameters.AddWithValue("@UserID", UserID); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw; } } Database db = DatabaseFactory.CreateDatabase("MyDBConnection1"); using (DbCommand cmd = db.GetSqlStringCommand(@" SELECT UserID, UserName, Password, EmailAddress FROM chUsers WHERE UserID = @UserID ")) try { db.AddInParameter(cmd, "@UserID", System.Data.DbType.Int32, UserID); using (IDataReader reader = db.ExecuteReader(cmd)) { if (reader.Read()) { User newUserID = new UserID(); newUserID.LoadFromDataReader(reader); return UserID; } } } catch (Exception ex) { throw; } return null; ts.Complete(); } } }Nai-Dong Jin...
All-Star
41630 Points
3558 Posts
Re: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable D...
Oct 24, 2007 03:02 AM|LINK
Hi,
From the error message you provided, the cause of the problem is that Distributed Transaction Manager has been disabled on your machine.
Could you please make sure that if the MSDTC service has been started? Following the steps below:
1.Open your control panel, click on Administrative Tools.
2.Click on Component Service, expand the component service node, and then expand the Computers child node.
3.Right click on My Computer, choose “Properties”, and check if the MSDTC works.
Hope that helps.
Thanks.
mikener
Member
534 Points
238 Posts
Re: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable D...
Mar 18, 2008 07:55 PM|LINK
I am having this same problem. What do you mean by see if the MSDTC works? Can you be more specific? I am unsure as to what options to set in order to get the service to run.
Thanks
BrinkSr
Member
2 Points
2 Posts
Re: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable D...
May 07, 2009 04:43 PM|LINK
I had a very similar problem. I was adding several rows to different tables within a transaction using LINQ. Within the transaction scope I was calling a function which accessed the SQL server (not even the same database, but the same SQL server). When I attempted to execute the transaction I got the same error you are getting. I moved the code that accessed the database outside the transaction scope so that I retrieved the value to a local variable, and, voila!!, the error went away.
sbadriprasad
Member
274 Points
305 Posts
Re: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable D...
Aug 03, 2009 10:03 AM|LINK
look into this link..
http://hspinfo.wordpress.com/2009/03/24/network-access-for-distributed-transaction-manager-msdtc-has-been-disabled/
rakesh2000_2...
Member
25 Points
43 Posts
Re: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable D...
Jan 09, 2010 10:15 PM|LINK
Its not a good idea to keep MSDTC open assuming firewall team will not be happy. Look out for articles in net for the same. TransactionScope will throw this error if multiple connections are being opened within it.