繁体   English   中英

asp.net mvc 4 中的等待操作超时

[英]The wait operation timed out in asp.net mvc 4

我有一个包含100 列和 2,000,000 条记录的表。

当我使用存储过程从中获取记录时,有时会收到“等待操作超时”。 错误。当我更改存储过程并尝试获取记录时,它工作正常。

谁能让我知道什么是最好的解决方案?

正如 vishal Naik 所提到的,SQL 服务器的默认查询超时设置为 30 秒。 一个可能的解决方案是为给定的查询手动增加这个时间,虽然不推荐这样做,但应该是有效的。 代码如下:

SqlCommand cmd = new SqlCommand(commandText, conn);
cmd.CommandTimeout = 60; // or any other length of time in seconds
/*Any other properties to be modified in the command will come here*/
SqlDataReader dataReader = cmd.ExecuteReader();

SQL Server 的默认查询超时设置为 30 秒。

欲了解更多详情, 请点击此处

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM