Communication with the underlying transaction manager has failed.

Does anyone know how to resolve this exception.

Exception:

Message: Communication with the underlying transaction manager has failed.

Stack Trace:

System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed. > System.Runtime.InteropServi

ces.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.

at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 p

ropgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& tran

sactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionS

him& transactionShim)

at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterP

ropigationToken(Byte[] propagationToken)

End of inner exception stack trace

at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterP

ropigationToken(Byte[] propagationToken)

at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTran

saction tx)

at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTrans

action tx)

at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)

at System.Transactions.Transaction.Promote()

at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transacti

on transaction)

at System.Transactions.TransactionInterop.GetExportCookie(Transaction transac

tion, Byte[] whereabouts)

at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)

at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)

at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transa

ction)

at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transacti

on transaction)

at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection ownin

gObject)

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection ow

ningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection ou

terConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

…. <<details about my code >>….

Client machine config

XP Pro with SP2

Visual Studio 2005

DTC configured to allow network access

1. Client and Administration Options [Allow Remote Clients and Allow RemoteAdministration] are checked

2. Transaction Managed Communication Options [Allow Inbound and Allow Outbound]are checked

3. Choose the option “No Authentication Required”

4. Enable Transaction Internet Protocol [TIP] Transactions

5. Enable XA Transactions.

Server machine config

Windows2000 with SP4

SQL Server 2005

Model:

Client calls an object, say ObjA, which creates a Transaction Scope and calls a method on another object, say ObjB. ObjB creates a transaction scope with "transaction required" option, inserts a row into a SQL 2005 table and sets the scope complete. {Note: Up to this step code works just fine, No DTC involved}. Then ObjA inserts a record into another SQL 2005 table. The SQL 2005 tables are on the same server and same database. At this point the ObjA code throws an exception when try to open the connection.

In order to take advantage of System.Transaction.TransactionScope, does the SQL Server 2005 installed on Windows 2003 server? [DTC version dependency]

IMPORTANT: Applied all the latest security patches from MS to the client [XP] and server [Win 2000] machine. Code works just fine on the local SQLExpress database.

Thanks.

[10470 byte] By [armo2006] at [2008-2-5]
# 1

Hey Armo,

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.

To expand on what is happening here:
As you mentioned, this isn't thrown until after you attempt to open the second connection. SqlClient uses the Transaction Management Escalation feature of System.Transactions when dealing with Sql 2005 (also known as PromotableSinglePhaseEnlistment). During the first connection the Commit of the Transaction is delegated to the escalateable enlistment (i.e. to SQL and its internal Transaction), so msdtc is not involved. When you attempt to open the second connection, SqlClient takes an action that forces us to escalate, or promote the management of the Transaction to msdtc. In doing so, we ask SQL to promote its internal Transaction to an msdtc Transaction. Sql does so on the server side and return to us on the client side a marshalled version of the msdtc Transaction. The last frame you see on the call stack of the exception is System.Transaction attempting to use this to Receive the Transaction from the server side. This requires us to communicate with the msdtc instance on the server machine. I beleive the firewall is preventing that and thus the TransactionManagerCommunicationException.

hth,
Miguel

MiguelGasca-MSFT at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Transactions Programming...
# 2

Thanks Miguel.

Configured the DTC as described in the technical artical,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndcom/html/msdn_dcomfirewall.asp

and as in the Component Services help
Component Services -> Help -> Component Services Administration Help
-> Administering Distributed Trasnactions -> Distributed Transaction Administration Tasks
-> Configuring MS DTC -> Configuring MS DTC to work Through a Firewall

These documents recommend to use the port id 135. However it works on both 134 and 135 [the RPC endpoint mapper].

On the server, configured the RPC, HKEY_LOCAL_MACHINE\Software\Microsoft\Rpc\Internet

Name Type Value
-- -- -
Ports REG_MULTI_SZ 3000-4000
134
PortsInternetAvailable REG_SZ Y
UseInternetPorts REG_SZ N

Note: firewall is off on the client.

It works just fine now.

Question, the Internet-accessible ports pose any security risk? How to mitigate them?

armo2006 at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Transactions Programming...
# 3

Miguel,

In your reply on 6/2/2006 you said,

"Check to make sure these [firewall settings on both the client machine and the server] are setup properly..."

I am having a similar problem like Armo has described, with a few differences. My client machine (and developer machine) is a Windows XP Pro machine with SP2 installed. The server with the databases on them is a Windows Server 2003 with SQL Server 2005 on it. However, the domain is a Windows 2000 Active Directory domain. I found a blog by Florin Lazar titled XP SP2 and Transactions which described how to set up the security configuration on the MS DTC tab in Component Services on my machine. I've tried to do this, and I think I've done it correctly. It did take care of an error that I was getting earlier, which was,

"Network access for Distributed Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administratve tool."

However, now I am getting a different error, which says:

"Communication with the underlyning transaction manager has failed."

I have checked the firewall settings on my PC, and the Windows Firewall is turned off. I've checked the server I'm running against (a test server), and it doesn't look to me as though it is turned on there, either. The message it gives is:

"Windows Firewall cannot run because the Windows Firewall/internet Conenction Sharing (ICS) service is not running..."

So, if you (or anyone else) is still reading this thread, what would you suggest that I do now, please?

RodatWork at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Transactions Programming...
# 4

Rod,

this article and the one you mentioned might help you: http://blogs.msdn.com/florinlazar/archive/2005/09/16/469064.aspx. Verify the situation with dtcping.

eglasius at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Transactions Programming...
# 5

eglasius,

Thank you for the information. I have not heard of DTCPing before, so I will check it out.

Rod

eglasius wrote:

Rod,

this article and the one you mentioned might help you: http://blogs.msdn.com/florinlazar/archive/2005/09/16/469064.aspx. Verify the situation with dtcping.

RodatWork at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Transactions Programming...
# 6

I tried some option as I was also facing same problem on Window XP operating system.

First of all swithced off firewall and allowded the all ICMP option from advance option.

Second thing that I did

>>Administrative Tools>>Component Services>> Computers>> Right Click>> Prpoerties.

From here i checked all the follwing options:

1 Allow inbound

2 allow outbound

3 allow remote clients

4 Allow remote administration

5 Enable TIP transactions.

6 Enable XA transaction

After all i restarted MSDTC and it was working fine

Regards

Kamal Thakur

KamalThakur at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Transactions Programming...

Software Development for Windows Vista

Site Classified