开发者

How can I stop this error when I'm debugging too long?

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 happe开发者_开发知识库ning?


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>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜