When distributed transactions go boing: Get Vista, XP, and SQL Server 2000 talking to each other

by Ted Jardine Wednesday, May 14, 2008 4:27 PM

From XP SP2 and on, all network communication coming out or getting to DTC (Distributed Transaction Coordinator) is disabled by default. For example, if a COM+ object attempts to update a SQL database on a remote computer using a DTC transaction, the transaction fails. Likewise, if your computer hosts a SQL database that components from remote computers try to access using a DTC transaction, their transactions fail. With Vista, it gets even more tightened down (see "Using MSDTC between Vista clients and Windows 2000 servers" for details).

On my development machine, I'm running Vista. As we still do the bulk of our work hooking into SQL Server 2000, I need to run that in a virtual machine; I haven't bothered making all these part of the same domain. Therefore, attempting to do some transactions (via System.Transaction.TransactionScope) makes everything go bonk if you're dealing with a setup like mine:

System.Transactions.TransactionException: The transaction has already been implicitly or explicitly committed or aborted.

And/Or:

The partner transaction manager has disabled its support for remote/network transactions.

And/Or:

MSDTC on server 'servername' is unavailable.

So here's how to make them all play nicely together so you can get back to getting productive work done:

(Caveat: this is for a development environment not production. Obviously, for production environments, you're going to have machines on the same domain, no sign of XP--or Vista for that matter--and can therefore tighten security up quite a bit...make that should tighten security up quite a lot)

  1. Enable MSDTC on Vista
    1. Run dcomcnfg (Component Services)
    2. Expand the "Component Services" node, then the "My Computer" node, then the "Distributed Transaction Coordinator" node
    3. Right-click on the "Local DTC" node and select "Properties"
    4. On the "Local DTC Properties", select the "Security" tab
    5. Select Network DTC Access, Allow Inbound, Allow Outbound, No Authentication Required, and Enable XA Transaction
      Note: reduced authentication security required because the machines are not on the same domain (in a production environment, they will be)
    6. Enable service auto start if you so wish:
      1. Run dcomcnfg again if necessary
      2. Locate Distributed Transaction Coordinator and right-click and select "Properties"
      3. In "General" tab, set startup type to "Automatic"
  2. Enable MSDTC on XP virtual machine
    1. Run dcomcnfg (Component Services)
    2. Expand the “Component Services” node, then the "My Computer" node
    3. Right-click on "My Computer" and select "Properties"
    4. Select "MSDTC" tab
    5. Click "Security Configuration"
    6. Check/Select "Network DTC Access", "Allow Remote Clients", "Allow Inbound", "Allow Outbound", "No Authentication Required", and "Enable XA Transactions"
    7. Okay your way out after the MSDTC service automatically restarts
    8. Enable service auto start if you so wish:
      1. Open SQL Server Service Manager (SQL Server 2000)
      2. Select Distributed Transaction Coordinator and check "Auto-start service when OS starts."
  3. Firewall
    1. On both machines you must add msdtc.exe to your list of exceptions (C:\Windows\System32\msdtc.exe)
    2. You might need to also open port 135. I didn't, but I've heard you might.
  4. Run your transaction code to ensure that it works. If not, reboot both machines.

I got the above from a bunch of various blogs, forum posts, and KB articles. Two that were the most helpful were:

blog comments powered by Disqus

Month List