June 13, 2013 / by Indu Alagarsamy / In Messaging /

Why can't my machines talk nicely!? - Troubleshooting MSMQ and DTC

You are already in the land of messaging, and have built your endpoints that use MSMQ as the transport of choice. Now comes the fun part, deployment! You deploy your endpoints to your servers and give it a try. The client endpoint is happy to send messages to the server endpoint and crickets on your server, or you get lovely transaction errors! And yes the machines are not playing nice with each other!

Here are some troubleshooting tips:

Can your machines ping each other?

Issue a ping from either machine to make sure that the machines can talk nice. Check by both IP address and name to make sure that name resolution works as expected.

Is your machine name too long?

For MSMQ to be able to send messages properly, the machine names must be 15 characters or less.

Do you have Windows firewall turned on?

If your firewall is turned on, ensure that Message Queueing and Distribution Transaction Coordinator are added to the list of Programs that are allowed in the firewall.

Are the ports configured correctly?

To verify: open ComponentServices. Expand Computers & right click on MyComputer → Properties. Click on Default Protocols tab. Click on Connection Oriented TCP/IP and then Properties and verify if the 5000-6000 port range is open. If not add the port range.

Open ports

Is DTC configured properly?

To verify: In Component Services, expand My Computer and expand Distribution Transaction Coordinator. Check the properties on Local DTC to see if its configured like below:

DTC Configuration

Have you cloned your VMs?

VMs are great. But if you have copied your VMs off of some image, then you need to know that there are some registry keys that cannot be the same for MSMQ to work properly. For more details read this post.

Re-install DTC by following these steps: Go to an administrative command prompt and type: msdtc -uninstall Go to HKEY_CLASSES_ROOT/CID and delete any keys if they are present Reboot the VM Goto an administrative command prompt and type: msdtc -install net start msdtc If you had previously enabled Distribution Transaction Coordinator in firewall settings, you’ll need to add it again to the allowed programs list. Generate a new QMId by following these steps: MSMQ uses a unique Id for every machine. In order to generate a new identifier, follow these steps: Stop MSMQ Service Goto HKLM\Software\Microsoft\MSMQ\Parameters\MachineCache and delete the REG_BINARY QMId Goto HKLM\Software\Microsoft\MSMQ\Parameters, add a DWORD called SysPrep and set it to 1 Restart MSMQ

What does DTCPing tell you?

DTCPing is a great tool that can help troubleshoot MSDTC woes between servers. Download DTCPing and run DTCPing on both the server and the client and start the test.

If you receive a Access is Denied error on DTCPing: make sure you add the following registry entries and try again. Add a key called RPC under HKEY_LOCAL_MACHINE\ SOFTWARE\Policies\ Microsoft\Windows NT Add a DWORD called RestrictRemoteClients under RPC and set the value to 0 If you received a duplicate CID warning, follow the steps outlined above for cloning the VMs. Essentially re-install DTC and generate a new QMId.

For more information on the read: Troubleshooting MSDTC issues with the DTCPing tool.

Using SQLServer and still having problems?

If running DTCPing on both machines produces the right results and you are still having trouble with transactions on the SQL Server, then try the DTCTester tool. The DTCTester establishes a connection to the SQL Server and creates a temporary table and enlists the connection in a transaction and does an insert on the temporary table and commits the transaction. It selects to read the inserted value and finally closes the connection.

For more details: Download DTCTester.

Hope these steps help in resolving your MSMQ, DTC, SQLServer woes!

2014 Indu Alagarsamy. All rights reserved.