Sql Server 2005 和 Linq 事务

发布于 2024-07-29 07:00:12 字数 305 浏览 3 评论 0原文

我遇到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

熟人话多 2024-08-05 07:00:12

看起来这是一个完全不同的问题,我在事务中使用了第二个 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文