Execute Reader wait operation time out error
11,888
Try by assigning 0 to the command timeout as below. A value of 0 indicates no limit (an attempt to execute a command will wait indefinitely). If its still timing out, optimize the stored procedure.
SqlCommand cmd = new SqlCommand(str, con);
cmd.CommandTimeout = 0;
con.Open();
rd = cmd.ExecuteReader();
Author by
Jayesh Patel
Updated on June 05, 2022Comments
-
Jayesh Patel almost 2 years
stuck on this since few days please help. I have tried a lot of solutions like increase connection timeout in web config: below is my error code.
Server Error in '/' Application. The wait operation timed out
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The wait operation timed out
Source Error:
Line 595: SqlCommand cmd = new SqlCommand(str, con); Line 596: con.Open(); Line 597: rd = cmd.ExecuteReader(); Line 598: //cs.CloseConnection(); Line 599: return rd; Source File: c:\inetpub\vhosts\xyz.com\httpdocs\App_Code\admin.cs Line: 597
Stack Trace:
[Win32Exception (0x80004005): The wait operation timed out] [SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1789294 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5340642 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61 System.Data.SqlClient.SqlDataReader.get_MetaData() +90 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +377 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1421 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +137 System.Data.SqlClient.SqlCommand.ExecuteReader() +99 admin.GetDatareader(String str) in c:\inetpub\vhosts\YXZ.com\httpdocs\App_Code\admin.cs:597 subcategories.Page_Load(Object sender, EventArgs e) in c:\inetpub\vhosts\XYZ.com\httpdocs\shop.aspx.cs:440 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51 System.Web.UI.Control.OnLoad(EventArgs e) +92 System.Web.UI.Control.LoadRecursive() +54 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34274