Click here to Skip to main content
13,901,343 members
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 5 Mar 2018
Licenced CPOL

Working with MSDTC...

, 17 Jul 2018
Rate this:
Please Sign up or sign in to vote.
All that you need to know when working with MSDTC, Troubleshooting and problem solving.


If you tried to search for MSDTC, the first result will describe MSDTC as an acronym for Microsoft Distributed Transaction Coordinator. As the name says, MSDTC is a Windows service providing transaction infrastructure for distributed systems. In this case, a transaction means a general way of structuring the interactions between autonomous agents in a distributed system. However, in my simple definition, it is a service from Microsoft that you need to deal with whenever you want to do transaction processing, and it is very hard to identify and troubleshoot any of the problems that you may face while interacting with it.


Doing transaction processing in your code is a very simple to do task, all that it needs to surround the part that you want to be executed as one transaction with one Transaction scope and commit it whenever you finish all parts.

But with the default setup on your machine, most likely you will end up with the below common MSDTC error:

Network access for Distributed Transaction Manager (MSDTC) has been disabled. 
Please enable DTC for network access in the security configuration for MSDTC using the 
Component Services Administrative tool.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Inner Exception:
The transaction manager has disabled its support for remote/network transactions. 
(Exception from HRESULT: 0x8004D024)



Using the Code

However, because of number of elements inside your and the server environment / network / firewall, which will interfere with MSTDC, and the lack of clear error reporting from the DTC itself, this task will become much harder.

Basic Setup

Since the most common scenario is to have Database / Application servers, having your code working fine on your machine does not means that it work fine once you deploy it on the server. When you connect to another server or DB server, that server needs to enable Distributed Transaction for network access on it as well.

Below are some of the basic setups that must you need do first in order for the MSDTC to work fine:

Still Not Working?

If you are trying to connect to another server, and you are getting an error simillar to the below, this means that its time to start cross machines investigation. follow the below steps to do more investigation about why it is not working.


Communication with the underlying transaction manager has failed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Inner Exception:
The MSDTC transaction manager was unable to pull the transaction from the source transaction manager 
due to communication problems. Possible causes are: a firewall is present and it doesn't have an 
exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, 
or the support for network transactions is not enabled for one of the two transaction managers. 
(Exception from HRESULT: 0x8004D02B)

Port 135

MSDTC uses port 135 to connect to other servers; a simple telnet command on port 135 should help you identify the problem, the command should be executed from both machines, as the port should be opened for both directions.

In the below example, let's imagine that your server IP address is "" and your IP address is "", both commands below should be working fine.

From your machine:

telnet 135

From server:

telnet 135

IP Address vs Machine Name

You need to make sure that both machines see each other using the same IP address, this problem usually occurs due to some domain configuration where they disable IP Address resolving within the network.

In order to identify this problem, you need to compare the results from running "IPconfig" command on machine A and a ping to the same Machine. The output IP address should be matching. In case it’s not, you need to modify the host server on machine B to have the IP corrected.

In the below example, let's imagine that your server IP address / name is " / Server1" and your IP address / name is " / MyMachine".

From Your Machine


//you will get results similar to

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . : 10.10.10.x

From Server

C:\>ping MyMachine

Pinging ENPAYSAFEDEVDB [] with 32 bytes of data:
Reply from bytes=32 time=1ms TTL=127
Reply from bytes=32 time=1ms TTL=127
Reply from bytes=32 time=1ms TTL=127
Reply from bytes=32 time<1ms TTL=127

The IP address should match, if not, the host file needs to be changed on server.

# localhost name resolution is handled within DNS itself.
#       localhost
#    ::1             localhost        MyMachine

Track Your Transactions

In order to exactly figure out what is happening, you need to track where your transaction is stuck at, the below methods can help you in this process:

If you are using SQL server, it is very easy to identify if the transaction has reach the database side or not. To do so, the below SQL command needs to be executed:

SELECT * FROM sys.sysprocesses WHERE open_tran = 1

The output will be something similar to:

The main keys listed below will help you understand this output:

  • lastwaittype: Check this reference to show what every waittype exactly means.
  • status: Current status for this transaction.
  • hostname: The source server/machine of this transaction.
  • cmd: The current command for the transaction is as follows:
    While Connecting Running
    When Connect Completed Sleeping / Awaiting Command
    Query e.g. select "1" Running
    When select completed Sleeping / Awaiting Command

At your side, you can also see the transactions from Component Services >> local DTC screen as follows:

This screen also give the option to "Commit", "Abort" and "Forget" this transaction.


DTCPing is very helpfull tool which can be downloaded directly from Microsoft website, this tool can assist you trhough debugging and diagnosing DTC issues, as it can simulate a DTC between two machines.

DTCPing can be downloaded from:



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Sufyan S Jabr
Technical Lead
United Arab Emirates United Arab Emirates
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionDTC? Pin
Member 1185598819-Jul-18 10:51
memberMember 1185598819-Jul-18 10:51 
GeneralMy vote of 5 Pin
nedcove18-Jul-18 7:10
membernedcove18-Jul-18 7:10 
QuestionPort 135-138 are likely closed by default Pin
Member 938386818-Jul-18 7:07
memberMember 938386818-Jul-18 7:07 
AnswerRe: Port 135-138 are likely closed by default Pin
Sufyan S Jabr18-Jul-18 16:07
memberSufyan S Jabr18-Jul-18 16:07 
QuestionMSDTC - Programmatically Pin
Tammam Koujan17-Jul-18 2:35
professionalTammam Koujan17-Jul-18 2:35 
AnswerRe: MSDTC - Programmatically Pin
Sufyan S Jabr18-Jul-18 16:04
memberSufyan S Jabr18-Jul-18 16:04 
QuestionSnippets Pin
Nelek20-Mar-18 0:30
protectorNelek20-Mar-18 0:30 
QuestionGood tool for msdtc Pin
Sacha Barber6-Mar-18 6:29
mvaSacha Barber6-Mar-18 6:29 
AnswerRe: Good tool for msdtc Pin
Sufyan S Jabr7-Mar-18 1:23
memberSufyan S Jabr7-Mar-18 1:23 
GeneralRe: Good tool for msdtc Pin
jandrej218-Jul-18 3:48
memberjandrej218-Jul-18 3:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190306.1 | Last Updated 17 Jul 2018
Article Copyright 2018 by Sufyan S Jabr
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid