none
Distributed Transaction Manager RRS feed

  • Question

  • hi to all

    i am developing web application with sqlserver 2005

    i am using subsonic for fatch insert update and delete 

    for any transaction i am using System.Transactions

    this will perfect working only one action will perform

    but when we do mulipal action like 2 record update in different table then it will generate 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.)

     

    My Code in C# 2.0

     

    int eeplanid = 0;

    int cobradetail_id = 0;

    try

    {

    using (TransactionScope ts = new TransactionScope())

    {

    Tbeeplan objtbeeplans = new Tbeeplan();

    objtbeeplans.EeID = Convert.ToInt32(hdneeid.Value != "" ? hdneeid.Value.ToString() : "0");

    objtbeeplans.PlanID = Convert.ToInt32(ddlplanid.SelectedValue.ToString());

    objtbeeplans.MarkNew();

    objtbeeplans.Save();

    eeplanid = objtbeeplans.EePlanID;

     

    TbEEPlanCOBRADetail objcobradetail= new TbEEPlanCOBRADetail();

    objcobradetail.EePlanID = eeplanid;

    objcobradetail.QbType = Convert.ToInt32(ddlqb_type.SelectedValue.ToString());

    objcobradetail.QeCardinality = Convert.ToInt32(ddlqe_cardinality.SelectedValue.ToString());

    objcobradetail.QeType = Convert.ToInt32(ddlqe_type.SelectedValue.ToString());

    objcobradetail.QeDate = Convert.ToDateTime(txtqe_date.Text.ToString());

    objcobradetail.LocDate = Convert.ToDateTime(txtloc_date.Text.ToString());

    objcobradetail.MarkNew();

    objcobradetail.Save();

    cobradetail_id = objcobradetail.COBRADetailId;

     

    ts.Complete();

    }

    }

    catch (Exception ex)

    {

     

    }

     

     

    Thursday, July 31, 2008 1:13 PM

Answers

  • The exception says that you need to enable network access for MSDTC. To enable it:

     

    open Control Panel\Administrative Tools\Component Services

    select Component Services\Computer\My Computer, right-click and choose Properties.
    On the MSDTC tab, press "Security Configuration..." and check if following options are  enabled:

    Network DTC Access

    Under Client and Administration
      Allow Remote Clients
      Allow Remote Administration

    Under Transaction Manager Communication
      Allow Inbound
      Allow Outbound
      No Authentication Required
      Enale XA Transactions

    After that, enable MSDTC application in Windows Firewall, if one is enabled.


    And then reboot your computer and retry.

     

    Thursday, July 31, 2008 3:59 PM
    Moderator

All replies

  • The exception says that you need to enable network access for MSDTC. To enable it:

     

    open Control Panel\Administrative Tools\Component Services

    select Component Services\Computer\My Computer, right-click and choose Properties.
    On the MSDTC tab, press "Security Configuration..." and check if following options are  enabled:

    Network DTC Access

    Under Client and Administration
      Allow Remote Clients
      Allow Remote Administration

    Under Transaction Manager Communication
      Allow Inbound
      Allow Outbound
      No Authentication Required
      Enale XA Transactions

    After that, enable MSDTC application in Windows Firewall, if one is enabled.


    And then reboot your computer and retry.

     

    Thursday, July 31, 2008 3:59 PM
    Moderator
  • (but when we do mulipal action like 2 record update in different table then it will generate error)

     

     

    This is the reason for your error SQL Server is escalating the System.Transaction operation into distributed transaction because you are doing multiple updates in a TransactionScope which makes your operation none atomic so you need a resource manager like MSDTC. 

     

    In SQL Server 2005 you don't need a resource manager if you change your code to one transaction at a time.  You have to decide if you should use Subsonic and use resource manager or drop it and change your code because MSDTC is expensive and not enabled in hosting sites.

     

     

     

    Monday, August 4, 2008 4:23 PM