【发布时间】:2019-05-09 05:01:25
【问题描述】:
我在两台不同的服务器上有两个不同的数据库,我使用了TransactionScope。我是第一次使用TransactionScope。
但是 在更新 Table1 时并发 我遇到了一个错误
事务(进程 ID 64)在锁定资源上与另一个进程死锁,并已被选为死锁牺牲品。重新运行事务。
查看TransactionScope网上相关文章
option.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
option.Timeout = TimeSpan.FromMinutes(1);
using (_objTransactionScope = new TransactionScope(TransactionScopeOption.Required, option))
{
//..Open Connection
//..Process the Document
//..Update Additional information in Table2 about document(Delete/Insert)
//..Update Location Information in Table3 about document(Delete/Insert)
//..Delete the Document in Table4 in Differant Database on Differant Server(WCF Service)
//..Update the Checksum of the Document and Metadata in Table1(Deadlock Error in concurrency)
//..Delete Lock Entry From Table5
//..Close Connection
//..Commit Transaction Scope
}
【问题讨论】:
-
一次只有一个进程连接到数据库,您无法收到此错误。所以有些事情你没有在这里发布,我们无法帮助你解决我们不知道的事情。请发布minimal reproducible example 并添加任何必要的其他信息。
-
请检查更新的详细信息..
标签: c# transactionscope