调试时如何处理TransactionScope?
我有由 ASP.NET 网站托管的 WebService。 TransactionScope 对象内部用于处理事务:
using (TransactionScope scope = new TransactionScope())
{
...
scope.Complete();
}
问题是在调试期间,当我以逐步模式遍历每一行时, 发生事务超时,任何访问数据库的尝试都会因“”错误而崩溃,结果是:禁止进一步调试。
我怎样才能在不删除提到的代码行的情况下处理这个问题?
PS 我试图找到如何增加创建事务的超时时间,但没有找到有用的东西。
欢迎任何想法。
谢谢。
I have WebService that is hosted by ASP.NET web site. Inside the TransactionScope object is used to handle transactions:
using (TransactionScope scope = new TransactionScope())
{
...
scope.Complete();
}
The problem is that during debugging, when I am going through each line in step-by-step mode,
transaction timeout is occurred and any attempt to access DB crashed with '' error, and as a result: further debugging is prohibited.
How could I handle that without deleting mentioned lines of code?
P.S. I've tried to find, how to increase a time-out of created transaction, but didn't find something helpful.
Any thoughts are welcome.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过传入零长度的 TimeSpan 作为构造函数的一部分来为事务指定无限超时:
Required 的 TransactionScopeOption 是无参数构造函数的默认值。
请参阅 http://msdn.microsoft.com/en- us/library/ms172152(VS.90).aspx 了解更多信息。
You can specify an infinite timeout for the Transaction by passing in a zero length TimeSpan as part of the constructor:
The TransactionScopeOption of Required is what is used as default with your parameterless constructor.
See http://msdn.microsoft.com/en-us/library/ms172152(VS.90).aspx for more information.