Follow @RoyOsherove on Twitter

Solving "An error occurred while enlisting in a distributed transaction" error when using Rollback Attribute or COM+ in unit tests

One of the things I'm most proud of creating is XtUnit, which allows Rolling back the effects of a unit test against a database. (which really means its an integration test - maybe we should call these hybrids "coded tests"?)

MbUnit added the same attribute to its core attribute set and now people are starting to get weird errors sometimes when using the rollback attribute:

"An error occurred while enlisting in a distributed transaction"

Steven Harman has a good explanation of what you should do when you get this error.

"This attribute works by enlisting a COM+ 1.5 transaction from the local Distributed Transaction Coordinator (DTC). This in and of itself is not an issue, but it does cause problems when the db you're trying to access sits on a remote server, as in my case. The COM+ 1.5 transaction attempts to use Transaction Internet Protocol (TIP) to access the remote SQL server. The problem is that Win2k3 Server & WinXP Pro SP2 both disable TIP by default.

The solution: Enable & Configure TIP on BOTH the remote server and the local dev box. Here's how:"

Read the exact steps here.

[via Andrew]

I'm looking for a great DBA!

I'm looking for a great tester to work with me