2

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?

2 Answers 2

1

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>
1
  • hi, i tried doing that, but it says i can't change the machinesettings unless i'm in the machine.config. How do you change the timeout?
    – Diskdrive
    Mar 10, 2011 at 3:58
0

You could dynamically change the timeout setting by code and wrap it inside an #if statement

#if DEBUG 
  change the timeout settings...
#endif

This way you would override this only while debugging and save the trouble of handling two sets of config file.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.