Sunday, February 13, 2011

Fix MSDTC (Microsoft Distributed transaction coordinator)

As everyone knows, in production environment is difference with development environment. I have got problem when I was setting up the servers, application server and database server.

I got the below error message when I pointed application’s connection string to database server.


[SqlException (0x80131904): MSDTC on server 'MYDATABASESERVER' is unavailable.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857306
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734918
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
System.Data.SqlClient.SqlDataReader.get_MetaData() +62
System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj) +600
System.Data.SqlClient.TdsParser.GetDTCAddress(Int32 timeout, TdsParserStateObject stateObj) +41
System.Data.SqlClient.SqlInternalConnectionTds.GetDTCAddress() +25
System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) +370
System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx) +735804
System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction) +730135
System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) +30
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1209
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Data.DLinq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) +38
System.Data.DLinq.SqlClient.SqlContext.get_IsServer2KOrEarlier() +31
System.Data.DLinq.SqlClient.SqlContext.Execute(Expression query) +351
System.Data.DLinq.SimpleChangeDirector.Update(TrackedObject item) +147
System.Data.DLinq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) +462
System.Data.DLinq.DataContext.SubmitChanges(ConflictMode failureMode) +229System.Data.DLinq.DataContext.SubmitChanges() +6

Note that, application server and database server are on Windows 2008 R2.


1. Start “Distributed Transaction Coordinator” (MSDTC) on application server and database server.


2. Config MSDTC over network security


3. Open fire wall for Distributed transaction coordinator (both Inbound and out bound)



4. If your DSDTC run on “Network service” account, you need to grant ACL to the MSDTC service.

This can be checked in the ACL (Access Control List) using the tool named "subinacl" and downloaded from:

The command for checking the permissions on the msdtc service is:
"subinacl.exe /Service msdtc"

-F -> Full Control
-R -> Generic Read
-W -> Generic Write
-X -> Generic eXecute
-L -> Read controL
-Q -> Query Service Configuration
-S -> Query Service Status
-E -> Enumerate Dependent Services
-C -> Service Change Configuration
-T -> Start Service
-O -> Stop Service
-P -> Pause/Continue Service
-I -> Interrogate Service
-U -> Service User-Defined Control Commands
You need permission on QSETIL for the MSDTC service.

I hope this help when you got a problem with MDSTC setting up. Please share if you have better idea or any suggestions.





Russ Taylor said...

That was a great help and made enabling it easy, thank you :)

chromesoft said...

Perfect post, after days of searching was the post whitch helped me

Ralph Jansen said...

Perfect post. This helpt me finding the problem. My firewall ports where closed.