.NET 中的 TransactionScope 错误?更多信息? [英] TransactionScope bug in .NET? More information?

查看:17
本文介绍了.NET 中的 TransactionScope 错误?更多信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经读到(或者可能从同事那里听说)在 .NET 中,TransactionScope 可以达到超时,然后是 VoteCommit(而不是 VoteRollback).这是准确的还是道听途说的?我无法在网络上找到有关此问题的信息(如果它是一个问题),所以我想知道是否有人对此有任何直接的经验并且可以提供一些启发?

I have read (or perhaps heard from a colleague) that in .NET, TransactionScope can hit its timeout and then VoteCommit (as opposed to VoteRollback). Is this accurate or hearsay? I couldn't track down information on the web that talked about this issue (if it IS an issue), so I wonder if anyone has any direct experience with it and can shed some light?

推荐答案

如果您的意思是与 SQL Server 相关,那么您可以在连接字符串中修复一个问题;在此处查看我的回复,或完整的细节 这里.

If you mean in relation to SQL Server, then there is an issue that you can fix in the connection string; see my reply here, or the full details here.

简短版本是:确保您在连接字符串中有Transaction Binding=Explicit Unbind;.

The short version is: ensure you have Transaction Binding=Explicit Unbind; in the connection string.

它实际上并没有进行投票提交 - 事务(和任何早期操作)已经回滚,但任何后续操作(仍在 TransactionScope 内)都可以在 nul-transaction 中执行, 即自动提交.

It isn't actually doing a vote commit - the transaction (and any early operations) has rolled back, but any subsequent operations (still inside the TransactionScope) can get performed in the nul-transaction, i.e. auto-commit.

这篇关于.NET 中的 TransactionScope 错误?更多信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆