2012-09-13 65 views
2

我正在調用一個休息全服務,該服務又在sql服務器數據庫中執行批量插入。當其他服務器和數據庫服務器位於同一臺計算機上時,每件事情都可以正常工作,但遇到異常情況下遠程數據庫服務器出現異常情況。帶有遠程sql服務器的批量插入異常

System.InvalidOperationException: The transaction associated with the current 
connection has completed but has not been disposed. 
The transaction must be disposed before the connection can be used to 
execute SQL statements. 

我正在使用以下事務。

TransactionOptions tOptions = new TransactionOptions(); 
tOptions.IsolationLevel = IsolationLevel.ReadCommitted; 
//This transaction is required here as it checks for all db operations. 
using (var transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew, tOptions)) 
{ 
    //DB operations.... 
    transactionScope.Complete(); 
} 
+0

我試圖transactionScope.Complete後transationScope.Dispose()(),但沒有工作。 –

回答