Webservice ,Autotransaction and msdtc and gotchas

Posted: May 27, 2005 in Uncategorized

There is a serious gotch in webservice transaction that is with distributed transaction the webmethod transaction not followed the correct rollback and it ddin’t follow ACID.

Below is such a gotcha i found :-I am calling 2 diiferent server with 2 connections and inserting values into 2 different tables in a transaction(server1–>table1 and server2–>table2).

while i am trying the same even though my second method is getting failed  due to

"The transaction manager has disabled its support for remote/network transactions"

the rollback didn’t happens for the first one.

thus even though msdtc failed for whatever reason since both are in a transaction the first should be rolled back.

Today i was working on one requirement to accomplish the following :-I need to sync up data in two different server at run time.

that is i need to create a transaction such that if i insert values in to table1 in server1 and table2 in server2 .I had 3 option

1.to use transaction in backend and use addlinkserver and put both inside the transaction

2.craete 2 diff component in com+(ES) and put them in single transeaction

3.mark the webmethod in trasaction.

i followed the 3rd option but to mywonder thouggh the second method is failing with msdtc error the transaction is not getting rolled back.

here goes my code:-


parentwebservice.spawnservice;using System.EnterpriseServices;


            public string transact()





                        string strcon="connstr to first server ";

                        using (con=new SqlConnection(strcon))



                              cmd=new SqlCommand();



                              cmd.Connection =con;




                        //call webservice 2

                        //spawnservice.Execchild svc=new spawnservice.Execchild();


                        //since the webservice call  gives me error 401 I directly using the

                        //second con here to carry my task

                        string strcon1="connstr to second server";

                        SqlConnection con1;

                        SqlCommand cmd1;

                        using (con1=new SqlConnection(strcon1))



                              cmd1=new SqlCommand();



                              cmd1.Connection =con;





                        return "success";


                  catch(Exception ex)


                        return ex.Message.ToString();





The next post i post with the msdtc experience with com+ and .net and later i discuss how in backend we use the same.





Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s