Stored procedure call in method with OperationBehavior attribute: problems with transactions

Posted by Gerrie Schenck on Stack Overflow See other posts from Stack Overflow or by Gerrie Schenck
Published on 2010-05-12T14:22:26Z Indexed on 2010/05/12 14:24 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

I'm using ADO.Net's ExecuteNonQuery to call a stored procedure, works like a charm stand-alone but when implementing it where it should be called I'm running into problems concerning transactions.

For example

System.Data.SqlClient.SqlException: Transaction count after EXECUTE indicates a 
mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.

and also a timeout right after that.

I've just found out the method which calls the stored procedure is marked with the following WCF attribute:

[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]

How will this influence the call my stored procedure? How can I tell .Net to execute the stored procedure outside this transaction?

The stored procedure contains insert statements and also a transaction, but removing them doesn't change the behavior...

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wcf