I'm using ASP.NET 3.5 (c#) with SQL Server 2008 server. Recently, I started getting error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.".
After looking at forums for solutions, I added the below common code to my application. protected DbCommand CreateCommand()
SqlCommand sqlCommand = new SqlCommand();
sqlCommand.CommandTimeout = 600; // 10 minutes
However, intermittently, I'm still getting the timeout error. I added the logging to see where error is occuring. And found that before executing one of the query, it is giving this error. Now, my assumption is that I should have received this error after runnign query for 600 seconds (10 minutes) since I set it in the above function. But the timeout error is occuring instantaneously within 1 second itself. In the log, I printed one line above & after the query to identify how much time it would take. Surprisingly, the log says that 9:00 AM "Before query execution" & at 9:01 AM "timeout expired...."
I would really appreciate if some one can help me out here!
View Complete Post