Introduction
This post is for helping people who would like to use distributed transactions in their programs. The post clarifies how to set up MSDTC and also the various errors that normally arise.
Steps
- In Run, type dcomcnfg.
- Expand Component Services.
- Expand Computers.
- Right click My Computer, click Properties.
- Go to MSDTC Tab.
- Under Transaction Configuration, click Security Configuration Button.
- In the Security Settings Section, check the following:
- Network DTC Access
- Allow Inbound
- Allow Outbound
- No authentication required
Reference: http://support.microsoft.com/kb/839279
Common Errors Occurring in Transaction
- 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 (
HRESULT : 0x8004D024
).
Configure MSDTC following the above method.
- MSDTC on server is unavailable.
Ensure that Distributed Transaction Coordinator is running on both client and server machines.
To check whether Distributed Transaction Coordinator is running:
- Right click My Computer, go to Services.
Start Distributed Transaction Coordinator.
(Or)
- Open Enterprise Manager.
Under Supported Services, start Distributed Transaction Coordinator.
- Transaction has either implicitly or explicitly committed, rolled back or aborted (
HRESULT 0x8004D00E
)
- Check the firewall settings:
- In Run, type
firewall.cpl
. - Click Exceptions Tab.
- Click Add Program.
- Browse for Msdtc.exe (normally found under C:\Windows\System32).
- Click Add Port.
- In the Add A Port window, give a name in the Name field.
- Give 135 in the Port Number Field.
- Select TCP.
- Click OK.
(Or)
- Check the network settings:
- Ping the server from client and client from server.
- If the ping succeeds, check whether any
LoopBackAdapter
is present. - If there is a loopback adapter, uninstall it and reboot the machine.
Confirm that the error no longer exists. Then, install the loopback adapter.
- Distributed Transaction has completed. Either enlist this session in a new transaction or the
NULL
transaction.
Check whether TransactionScope.Complete()
has been called.