---
title: "Solving &quot;An error occurred while enlisting in a distributed transaction&quot; error when using Rollback Attribute or COM+ in unit tests"
url: "https://osherove.com/blog/2006/11/25/solving-ampquotan-error-occurred-while-enlisting-in-a-distri.md"
canonical: "https://osherove.com/blog/2006/11/25/solving-ampquotan-error-occurred-while-enlisting-in-a-distri.html"
published: "2006-11-25T14:14:01"
updated: "2006-11-25T14:14:01"
tags: ["Unit Testing"]
author: "Roy Osherove"
description: "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…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Solving &quot;An error occurred while enlisting in a distributed transaction&quot; error when using Rollback Attribute or COM+ in unit tests

By Roy Osherove November 25, 2006 In [Unit Testing](https://osherove.com/blog/category/unit-testing)

**Historical article** · Originally published November 25, 2006; technical details may be outdated.

One of the things I'm most proud of creating is [XtUnit](http://weblogs.asp.net/rosherove/archive/2004/10/05/238201.aspx), 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](http://build.mutantdesign.co.uk/builds/) 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](http://stevenharman.net/blog/archive/2005/12/28/MbUnitCOMTransactions.aspx) 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](http://support.microsoft.com/kb/908620) (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](http://stevenharman.net/blog/archive/2005/12/28/MbUnitCOMTransactions.aspx).

\[via [Andrew](http://weblogs.asp.net/astopford/archive/2006/11/25/setting-up-for-mbunit-database-rollback.aspx)\]

## More in Unit Testing

[All posts in Unit Testing](https://osherove.com/blog/category/unit-testing)

- Dec 8, 2006

    ### [BSDAgile - Team System Project Template for Extreme Programming](https://osherove.com/blog/2006/12/8/bsdagile-team-system-project-template-for-extreme-programmin.html)

- Dec 5, 2006

    ### [Extended Unit Test Attributes for Team System](https://osherove.com/blog/2006/12/5/extended-unit-test-attributes-for-team-system.html)

- Nov 7, 2006

    ### [Agile Development Sessions - Slides and Demos from TechEd](https://osherove.com/blog/2006/11/7/agile-development-sessions-slides-and-demos-from-teched.html)

- Oct 15, 2006

    ### [MassDataHandler: generate test data to help with data layer testing](https://osherove.com/blog/2006/10/15/massdatahandler-generate-test-data-to-help-with-data-layer-t.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
