本次交易已中止

2023-09-04 12:10:45 作者:厕所看蛆

我有一个多线程的C#应用​​程序,每个线程都有它自己的一套数据库的连接。每个线程使用的TransactionScope / DTC。有时候,我得到了该交易已中止异常。它不是从一个超时,因为它发生在小于2秒从启动事务。

I have a multithreaded C# application where each thread has it's own set of db connections. Each thread uses TransactionScope / DTC. Sometimes, I get a "The transaction has aborted" exception. It's not from a timeout since it occurs in less than 2 seconds from starting the transaction.

下面的堆栈跟踪:

在   System.Transactions.TransactionStateAborted.BeginCommit(InternalTransaction   TX,布尔asyncCommit,AsyncCallback的   AsyncCallback的,对象asyncState)在   System.Transactions.CommittableTransaction.Commit()   在   System.Transactions.TransactionScope.InternalDispose()   在   System.Transactions.TransactionScope.Dispose()   在MyNamespace.CallingMethod()

at System.Transactions.TransactionStateAborted.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState) at System.Transactions.CommittableTransaction.Commit() at System.Transactions.TransactionScope.InternalDispose() at System.Transactions.TransactionScope.Dispose() at MyNamespace.CallingMethod()

这一切发生的非常频繁,说一旦10万的交易。

It happenes very infrequently, say once in 100,000 transactions.

环境: Windows Server 2003中 NET 2.0 连接到SqlServer的2005

Environment: Windows Server 2003 .Net 2.0 Connects to SqlServer 2005

为什么这是发生任何想法? 谢谢!

Any ideas on why this is occuring? Thanks!

推荐答案

我想这是由于网络不稳定。这是非常罕见的,并没有饲养它丑陋的头,现在好几个月。

I think this is attributed to network instability. It is very infrequent, and hasn't reared it's ugly head in quite a few months now.

相关推荐