WCF The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)

1

I have a simple update method like below:

public static void Execute()
{
    var conn = new SqlConnection(ConnectionString);
    conn.Open();
    var cmd = new SqlCommand(UpdateQuery, conn);
    cmd.ExecuteNonQuery();
}

Case 1

When I call this method from a Console Application everything works as expected. Since I do not Complete the TransactionScope update is rollbacked.

using (new TransactionScope())
{
    TestUpdate.Execute();
}

Case 2

I create a WCF service and call this method inside the wcf operation like below. Again everything works as expected. Since I do not Complete the TransactionScope update is rollbacked.

// Interface
[OperationContract, TransactionFlow(TransactionFlowOption.Allowed)]
void DoWork2();

// Implementation
public void DoWork2()
{
    using (new TransactionScope())
    {
        TestUpdate.Execute();
    }
}

// Console App
var client = new StaticServiceClient();
client.DoWork2();

Case 3

I start a transaction in the Console Application and call the service from the Console Application with in this transaction. When I debug I can see that Transaction.Current is not null on IIS and I expect code executed in IIS will use this transaction. But below exception is thrown inside conn.Open();.

The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)

// Interface
[OperationContract, TransactionFlow(TransactionFlowOption.Allowed)]
void DoWork();

// Implementation
[OperationBehavior(TransactionScopeRequired = true)]
public void DoWork()
{
    TestUpdate.Execute();
}

// Console App
using (new TransactionScope())
{
    var client = new StaticServiceClient();
    client.DoWork();
}

Question

Console Application is executed on my local machine and WCF service is hosted on my local IIS. Database is on another server in the same network. I believe, first two cases prove that MSDTC is working fine on both my local machine and the database server. Then, what may be the problem with the third case?

Configurations

Server

<bindings>
  <wsHttpBinding>
    <binding name="soapBinding" transactionFlow="true">
      <security mode="None" />
    </binding>
  </wsHttpBinding>
</bindings>
<services>
  <service name="ServiceLib.StaticService">
    <endpoint contract="ServiceLib.IStaticService" name="soap" binding="wsHttpBinding" bindingConfiguration="soapBinding" address="http://localhost:58759/StaticService.svc/Soap" />
  </service>
</services>

Client

<bindings>
  <wsHttpBinding>
    <binding name="soap" transactionFlow="true">
      <security mode="None" />
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost:58759/StaticService.svc/Soap"
    binding="wsHttpBinding" bindingConfiguration="soap" contract="ServiceReference.IStaticService"
    name="soap" />
</client>
c#
wcf
iis
transactions
distributed-transactions
asked on Stack Overflow Jul 23, 2015 by Mehmet Ataş

1 Answer

1

Make sure the DTC security settings are as below on both WCF and DB servers:

enter image description here

answered on Stack Overflow Jul 26, 2015 by tom redfern

User contributions licensed under CC BY-SA 3.0