Wednesday, 13 June 2018

MSDTC issue

Hi everyone, probably each of you have come across a MSTDTC issue when working with sql server or other DB's. In the last few days i had an issue with it, and took us 2 days to figure out what's teh problem. So i would like to share with you my story so it can help you, as it was really annoying thing. Normally with MSDTC you have to set the DTC on your computer to allow inbound outbound traffic.
You got DTC from component services:













Then you configure it according to your need:

















The next step is to check that Distributed transaction service works:


Now after doing all these it still didn't work. So the next step is to check the firewall setting on client and server machine and make sure all relevant ports are open: 135,1433,1434,5000-5050.

A good tools to check if firewall is stopping traffic is: DTCPing. It's important to install it on Client and Server. After installing open it on both machines and only then start making a call, if it's open only on one machine it will tell you that there is an error.

After you ruled out that there is no firewall issue you can use another tool for checking MSDTC issues: DTCTester 
This article explains in more detail the difference between the tools and how to use DTCTester.

I did all of it but still MSDTC didn't work, i saw that all transactions were being aborted. I did find an article about issues with netbios names, so our IT had a better look at the dns names of the machine and what we found out after 2 days was, that the client machine had a NetBIOS name of more than 15 characters which is not allowed. Now  MSDTC uses NetBios name, but because it can only have 15 charters and not more it took down all the characters after the 15th. So the client made a successful call to the server, but when the server wanted to reply he searched for the machine name with only 15 characters, but couldn't find it as the client has 17 characters name and therefore it failed.
So what IT did is to put on the server machine in the host file the IP of the client machine with the shorted 15 characters, so the server knew that the 15 character name apply to a specific machine with IP given and that way he could connect to the client machine.