简体   繁体   English

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

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

I have a table contains 100 columns and 2,000,000 records .我有一个包含100 列和 2,000,000 条记录的表。

When I am fetching records using stored procedure from that sometimes I am getting "The wait operation timed out."当我使用存储过程从中获取记录时,有时会收到“等待操作超时”。 error .When I alter the stored procedure and try to fetch the records, it works fine.错误。当我更改存储过程并尝试获取记录时,它工作正常。

Can anyone let me know what is the best solution for this ?谁能让我知道什么是最好的解决方案?

As vishal Naik has mentioned, SQL server has a default query timeout setting of 30 seconds.正如 vishal Naik 所提到的,SQL 服务器的默认查询超时设置为 30 秒。 A possible solution would be to manually increase this time for a given query and this, while not recommended, should be effective.一个可能的解决方案是为给定的查询手动增加这个时间,虽然不推荐这样做,但应该是有效的。 The code is as follows:代码如下:

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 has default query timeout setting of 30 seconds. SQL Server 的默认查询超时设置为 30 秒。

For more details click here欲了解更多详情, 请点击此处

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

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