Sql Server 2005 和 Linq 事务
我遇到 linq-to-sql 事务在 30 秒后超时的问题。
在 DataContext 上设置 CommandTimeout 属性似乎不会更改超时。
我收到的错误消息是:
“超时已过期。在操作完成之前超时时间已过,或者服务器没有响应”
耗时少于 30 秒的查询工作正常。 仅当交易时间> 30秒后会弹出错误。
根据文档,CommandTimeout 属性值是由数据源获取的 - 该值可以在 SQL Server Management Studio 中定义吗?
谢谢
I'm having a problem with a transaction in linq-to-sql timing out after 30 seconds.
Setting the CommandTimeout property on the DataContext does not seem to change the timeout.
The error message I get is:
"Timeout Expired. The timeout period elapsed prior to the completion of the operation or the server is not responding"
Queries that take less than 30 seconds work fine. only when the transaction takes > 30 seconds does the error pop up.
According to the documentation the CommandTimeout property value is obtained by the datasource - can this value be defined in SQL Server Management Studio?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这是一个完全不同的问题,我在事务中使用了第二个 DataContext*,我猜它导致了其中一个表的锁定 - 因为查询(一个简单的选择)没有从 sql 返回服务器 - 这是超时的原因。
*我其实并不是有意这么做的。
Looks like it was a different problem all-togeather, I was using a second DataContext* inside of my transaction and I guess it was causing a lock on one of the tables - as the query (a simple select) wasn't returning from sql server - which was the cause of the timeout.
*I didn't actually mean to do that.