簡體   English   中英

與遠程SQL Server批量插入的異常

[英]Exception with bulk insert with remote sql server

我正在調用其余的完整服務,該服務又在sql server數據庫中執行批量插入。 當其余服務器和數據庫服務器位於同一台計算機上時,一切正常,但是在遠程數據庫服務器的情況下,將引發以下異常。

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();
}

在我的IIS服務器上配置Windows MSDTC服務可以解決問題。

以下鏈接顯示了如何配置MSDTC。

http://www.deepakkapoor.net/turn-on-msdtc-windows-7/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM