Microsoft Developer Network > 포럼 홈 > ADO.NET Data Providers > Distributed Transaction Manager
질문하기질문하기
 

답변됨Distributed Transaction Manager

  • 2008년 7월 31일 목요일 오후 1:13Chirag vm 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    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)

    {

     

    }

     

     

답변

  • 2008년 7월 31일 목요일 오후 3:59Nissim Natanov _MSFT_중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨

    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.

     

모든 응답

  • 2008년 7월 31일 목요일 오후 3:59Nissim Natanov _MSFT_중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨

    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.

     

  • 2008년 8월 4일 월요일 오후 4:23Caddre 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    (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.