I'm debugging through a web service, and inside the web service I have a transaction scope which does all my writes at the end if I don't make any mistakes.
Anyway, it all works unless I decide to step through, and then when I debug for too long, if I write to the database, I get this error.
{"The operation is not valid for the state of the transaction."}
How do I prevent this from happening?
This could be a time out issue, can you post some code? Usually you can change the timeout property of a transaction scope.
The other thing you could do is if you have a config file to change the timeout value there:
example:
<system.transactions>
<machineSettings maxTimeout="01:00:00" />
</system.transactions>