2

I am calling a rest full service which in turn performs bulk insert in sql server database. Every thing works fine when rest server and the database server are on same machine, but in case of remote database sever following exception is encoutered.

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.

I am using following transactions.

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();
}
1
  • I tried transationScope.Dispose() after transactionScope.Complete() but that didnt work. Commented Sep 13, 2012 at 5:36

1 Answer 1

1

Configuring the windows MSDTC service on my IIS server did the trick.

The following link shows how to configure MSDTC.

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.