Here’s a clue:
2010-11-02 23:33:45,558 [web1devursdca] [7] [] DEBUG: UnitOfWorkScope created.
UoW:10511147 Request:11323545
2010-11-02 23:33:45,558 [web1devursdca] [5] [tscott] DEBUG: Committing UnitOfWorkScope.
UoW:10511147 Request:11323545
2010-11-02 23:33:45,558 [web1devursdca] [5] [tscott] ERROR: System.InvalidOperationException: A TransactionScope must be disposed on the same thread that it was created.
at System.Transactions.TransactionScope.Dispose()
at NCommon.Data.Impl.UnitOfWorkTransaction.Dispose(Boolean disposing) in F:\SANDBOX\NCommon\NCommon\src\Data\Impl\UnitOfWorkTransaction.cs:line 168
at NCommon.Data.Impl.UnitOfWorkTransaction.OnScopeCommitting(IUnitOfWorkScope scope) in F:\SANDBOX\NCommon\NCommon\src\Data\Impl\UnitOfWorkTransaction.cs:line 124
at NCommon.Data.UnitOfWorkScope.OnCommit() in F:\SANDBOX\NCommon\NCommon\src\Data\UnitOfWorkScope.cs:line 143
at NCommon.Data.UnitOfWorkScope.Commit() in F:\SANDBOX\NCommon\NCommon\src\Data\UnitOfWorkScope.cs:line 124
at UnitedRoad.Logistics.Web.UI.Global.Application_EndRequest(Object sender, EventArgs e) in c:\Builds\Logistics\Checkout\Source\Application\Logistics.Web.UI\Global.asax.cs:line 67
The hash codes of the unit of work scope and the HTTP request prove that we have the same UoW scope instance at the beginning and end of the request. But the request begins on thread 7 and ends on thread 5. TransactionScope.Dispose() does not like that. From what I’ve read, a request normally stays on a single thread. Is there anything about multiple databases in NCommon that could cause the request to “jump threads?”
What’s strange is that I don’t get this on my local box. Maybe because it’s XP. Also, we’ve used Ncommon 1.0 (single database) for a good while now with no issues like this.
Thanks again for any ideas or help.