Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Network access for Distributed Transaction Manager (MSDTC) has been disabled

Tags:

error:

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.

using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope())    11                 {    12                     try   13                     {    14                         foreach (DataRow row in this.dt1.Rows)    15                         {    16                             int titleId = int.Parse(row["titleId"].ToString());    17                             string fname = row["fname"].ToString();    18                             string lname = row["lname"].ToString();    19    20                             if (cmd.Parameters.Count > 0)    21                                 cmd.Parameters.Clear();    22    23                             cmd.Parameters.AddWithValue("@titleId", titleId);    24                             cmd.Parameters.AddWithValue("@fname", fname);    25                             cmd.Parameters.AddWithValue("@lname", lname);    26                             cmd.ExecuteNonQuery();    27    28                         }    29                         con.Close();    30                         ts.Complete();    31                     }    32                     catch (Exception ex)    33                     {    34    35                     }                        36                 }    37             }   
like image 531
Nick Kahn Avatar asked Mar 01 '11 01:03

Nick Kahn


People also ask

How do I enable DTC for network access in the security configuration for MSDTC using the Component Services administrative tool?

On the MSDTC tab, click Security Configuration under Transaction Configuration, click to select the Network DTC Access check box under Security Settings, and then click to select the following check boxes under Transaction Manager Communication: Allow Inbound. Allow Outbound.

What is MSDTC error?

Error “New transaction cannot enlist in the specified transaction coordinator (0x8004d00a)” occurs if the MSDTC connection between a client computer and a server computer is closed. Consider reinstalling the Distributed Transaction Coordinator service if other troubleshooting steps are not successful.

What is MSDTC service?

The Microsoft Distributed Transaction Coordinator (MSDTC) service is a component of modern versions of Microsoft Windows that is responsible for coordinating transactions that span multiple resource managers, such as databases, message queues, and file systems.


2 Answers

To enable Network access to MSDTC on Windows Vista/7/8 Server 2008R2/2012, follow the steps below:

  1. Click Start, click Run, type dcomcnfg and then click OK to open Component Services.

  2. In the console tree, click to expand Component Services, click to expand Computers, click to expand My Computer, click to expand Distributed Transaction Coordinator and then click Local DTC.

  3. Right click Local DTC and click Properties to display the Local DTC Properties dialog box.

  4. Click the Security tab.

  5. Check mark "Network DTC Access" checkbox.

  6. Finally check mark "Allow Inbound" and "Allow Outbound" checkboxes.

  7. Click Apply, OK.

  8. A message will pop up about restarting the service.

  9. Click OK and That's all.

like image 169
Sundeep Avatar answered Sep 21 '22 13:09

Sundeep


Close the connection after the transaction scope Complete method.

ts.Complete(); con.Close();    

the completed code is

using (System.Transactions.TransactionScope ts = new  Sytem.Transactions.TransactionScope())    {        try       {            foreach (DataRow row in this.dt1.Rows)            {                int titleId = int.Parse(row["titleId"].ToString());                string fname = row["fname"].ToString();                string lname = row["lname"].ToString();                 if (cmd.Parameters.Count > 0)                    cmd.Parameters.Clear();                 cmd.Parameters.AddWithValue("@titleId", titleId);                cmd.Parameters.AddWithValue("@fname", fname);                cmd.Parameters.AddWithValue("@lname", lname);                cmd.ExecuteNonQuery();            }            ts.Complete();          con.Close();          }        catch (Exception ex)        {        }                        }     
like image 32
Thamotharan Karuppiah Avatar answered Sep 18 '22 13:09

Thamotharan Karuppiah