My name is Steven Graves and I am a Senior Support Escalation Engineer on the Windows Core Team. In this blog, I will discuss how to configure MSDTC to use a specific port on Windows Server 2012/2012R2 as this has slightly changed from the way it is configured in Windows Server 2008 R2 in order to prevent overlapping ports. As a reference, here is the blog for Windows 2008 R2.
How to configure the MSDTC service to listen on a specific RPC server port
There is a web server in a perimeter network and a standalone SQL Server (or Clustered SQL Server instance) on a backend production network and a firewall that separates the networks. MSDTC needs to be configured between the web server and backend SQL Server using a specific port in order to limit the ports opened on the firewall between the networks.
So as an example, we will configure MSDTC to use port 5000.
There are two things that need to be configured on the frontend web server to restrict the ports that MSDTC will use.
- Configure the ports DCOM can use
- Configure the specific port or ports for MSDTC to use
1. On the web server launch Dcomcnfg.exefrom the Run menu.
2. Expand Component Services, right click My Computer and select Properties
3. Select the Default Protocols tab
4. Click Properties button
5. Click Add
6. Type in the port range that is above the port MSDTC will use. In this case, I will use ports 5001-6000.
7. Click OK back to My Computer properties window and click OK. Here is the key that is modified in the Registry for the ephemeral ports.
8. Start Regedt32.exe
9. Locate HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC
10. Right click the MSDTC key, select New and DWord (32-bit) Value
11. Type ServerTcpPort for the key name
12. Right click ServerTcpPort key and select Modify
13. Change radio button to Decimal and type 5000 in the value data, click OK. This is how the registry key should look
14. Restart the MSDTC Service (if stand-alone) or take the MSDTC Resource offline/online in Failover Cluster Manager if clustered.
To confirm MSDTC is using the correct port:
- Open an Administrative command prompt and run Netstat –ano to get the port and the Process Identifier (PID)
- Start Task Manager and select Details tab
- Find MSDTC.exe and get the PID
- Review the output for the PID to show it is MSDTC
Now DTC will be using the port specified in the registry and no other processes will try to use the same port thus preventing an overlap of ports.
Senior Support Escalation Engineer
Microsoft Core Support