問題描述
我已經讀到(或者可能從同事那里聽說)在 .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 錯誤?更多信息?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!