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


i have simple update method below:

public static void execute() {     var conn = new sqlconnection(connectionstring);     conn.open();     var cmd = new sqlcommand(updatequery, conn);     cmd.executenonquery(); } 

case 1

when call method console application works expected. since not complete transactionscope update rollbacked.

using (new transactionscope()) {     testupdate.execute(); } 

case 2

i create wcf service , call method inside wcf operation below. again works expected. since not complete transactionscope update 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 transaction in console application , call service console application in transaction. when debug can see transaction.current not null on iis , expect code executed in iis use transaction. below exception thrown inside conn.open();.

the partner transaction manager has disabled support remote/network transactions. (exception 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 executed on local machine , wcf service hosted on local iis. database on server in same network. believe, first 2 cases prove msdtc working fine on both local machine , database server. then, may problem 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> 

make sure dtc security settings below on both wcf , db servers:

enter image description here


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -