Tags: class, communication, database, dtc, error, limitations, message, microsoft, mysql, oracle, receiving, server, sql, system, transactions, transactionscope

TransactionScope Limitations and MS DTC

On Database » Microsoft SQL Server

3,665 words with 3 Comments; publish: Sun, 06 Jan 2008 09:24:00 GMT; (25062.50, « »)

I am receiving an error message while using the System.Transactions.TransactionScope class. The error message that I am receiving is "Communication with the underlying transaction manager has failed". This error seems to only appear when I have my web application one server, Server1, and my database on a second, Server2. When I run the web app on the same server as the database (i.e., web site and database on Server2), I don't receive this error. So, this leads me to believe this has something to do with MS DTC.

Is there a limit to how much data MS DTC can manage for a given transaction? If so, is it configurable?

When I run my code, the application fails after a certain number of steps (this is repeatable). See sample code below. When I execute the code below, the error occurs on UpdateBody2();. If I comment out UpdateBody2(), the error will now occur on UpdateBody3();, and so on. This leads me to believe that I have hit some upper limit.

My code follows a pattern similar to this:

using {TransactionScope scope = new TransactionScope())








Where each of the classes follows a pattern of:



using (SqlConnection conn = new SqlConnection())



// Do something






SQL/2005 Standard

Windows Server 2003



All Comments

Leave a comment...

    • I suspect that remote transaction is limited to single connection string.

      #1; Sun, 06 Jan 2008 09:25:00 GMT
    • Hi,

      From your description, it seems that the error only occurs while you deploy your application and database on different servers, right?

      Actually, MSDTC will need to be allowed through any firewalls on both machines as will port 134 (the RPC endpoint mapper). Check to make sure these things are setup properly and let me know if it's still failing.

      For more information on what is happening between different servers, you may refer the following thread:



      #2; Sun, 06 Jan 2008 09:26:00 GMT
    • Hi,

      Yes, the application and database are on different servers.

      The good news is that I am passed my problem. In my application, I was under the impression that I was doing Light-Weight Transactions because I was mainting the same connection string throughout the TransactionScope. However, I was wrong!

      Within the TransactionScope, each time I openned a second SqlConnection, the transaction would get promoted. At this point MS DTC gets involved. This is also described in the link you mentioned above (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=444383&SiteID=1).

      In order to maintain a LWT, I did some searching and found a solution that helps. Here is a snippet:

      using (TransactionScope scope = new TransactionScope())


      using (DbConnectionScope dbscope = new DbConnectionScope()) // Creates a resuable connection object


      // Do you work in here. Each class participating in this transaction would resuse the SqlConnection created by DBConnectionScope



      For DBConnectionScope overview, check out http://blogs.msdn.com/dataaccess/archive/2006/02/14/532026.aspx.

      Thanks for your input.


      #3; Sun, 06 Jan 2008 09:27:00 GMT