Yogesh Khurpe
Yogesh Khurpe

Reputation: 31

The wait operation timed out in asp.net mvc 4

I have a table contains 100 columns and 2,000,000 records.

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 ?

Upvotes: 1

Views: 2880

Answers (2)

YashTD
YashTD

Reputation: 438

As vishal Naik has mentioned, SQL server has a default query timeout setting of 30 seconds. 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();

Upvotes: 1

vishal Naik
vishal Naik

Reputation: 28

SQL server has default query timeout setting of 30 seconds.

For more details click here

Upvotes: 0

Related Questions