简体   繁体   English

The wait operation timed out Win32Exception (0x80004005): The wait operation timed out azure

[英]The wait operation timed out Win32Exception (0x80004005): The wait operation timed out azure

Following error comes when retrieving large amount of data from sql azure.从 sql azure 检索大量数据时出现以下错误。 I have already implement the Transient Fault Handling but still getting this error我已经实现了瞬态故障处理,但仍然收到此错误

Description: An unhandled exception occurred during the execution of the current web request.说明:在执行当前 Web 请求期间发生未处理的异常。 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异常详细信息:System.ComponentModel.Win32Exception:等待操作超时

Source Error:源错误:

An unhandled exception was generated during the execution of the current web request.执行当前 Web 请求期间生成了未处理的异常。 Information regarding the origin and location of the exception can be identified using the exception stack trace below.可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息。

Stack Trace:堆栈跟踪:

[Win32Exception (0x80004005): The wait operation timed out] [Win32Exception (0x80004005): 等待操作超时]

[SqlException (0x80131904): Timeout expired. [SqlException (0x80131904): 超时已过期。 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) +1789270 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action 1 wrapCloseInAction) +5340622 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.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +275 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32操作完成之前超时时间已过或服务器未响应。] System.Data.SqlClient.SqlConnection.OnError(SqlException 异常,布尔中断连接,操作1 wrapCloseInAction) +1789270 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action 1 wrapCloseInAction) +5340622 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244 System.Data.SqlClient.TdsParCommander.TryHandler,SqlData. dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +275 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds,Command Behavior RunExecuteReaderTds(布尔返回流、布尔异步、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.InternalExecuteNonQuery(TaskCompletionSource 1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +208 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +163 System.Web.SessionState.SqlSessionStateStore.SqlExecuteNonQueryWithRetry(SqlCommand cmd, Boolean ignoreInsertPKException, String id) +98超时,Task& 任务,布尔 asyncWrite,SqlDataReader ds) +1421 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String 方法, TaskCompletionSource 1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource 1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +208 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +163 System.Web.SessionState.SqlSessionStateStore.SqlExecuteNonQueryWithRetry (SqlCommand cmd, Boolean ignoreInsertPKException, String id) +98

[HttpException (0x80004005): Unable to connect to SQL Server session database.] System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e) +235 System.Web.SessionState.SqlSessionStateStore.SqlExecuteNonQueryWithRetry(SqlCommand cmd, Boolean ignoreInsertPKException, String id) +390 System.Web.SessionState.SqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +589 System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +565 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69 [HttpException (0x80004005): 无法连接到 SQL Server 会话数据库。] System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e) +235 System.Web.SessionState.SqlSessionStateStore.SqlExecuteNonQueryWithRetry(SqlCommand cmd, Boolean ignoreInsertPKException, String id) +390 System.Web.SessionState.SqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +589 System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +565 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&completedSynchronously) +69

Version Information: Microsoft .NET Framework Version:4.0.30319;版本信息:Microsoft .NET Framework 版本:4.0.30319; ASP.NET Version:4.0.30319.34009 ASP.NET 版本:4.0.30319.34009

http://i.stack.imgur.com/8BloW.png http://i.stack.imgur.com/8BloW.png

The SqlClient.SqlCommand object has a property CommandTimeout. SqlClient.SqlCommand 对象有一个属性 CommandTimeout。 It's default value is 30 (seconds).它的默认值为 30(秒)。 You should set it to a higher value.您应该将其设置为更高的值。

You can set the timeout value higher or you can turn off the timeout value, as I did in the below code.您可以将超时值设置得更高,也可以关闭超时值,就像我在下面的代码中所做的那样。 Note that you may encounter errors if the object that holds the data exceeds 2Gb.请注意,如果保存数据的对象超过 2Gb,您可能会遇到错误。 You may want to consider redesigning your query to take smaller chunks of data at a time.您可能需要考虑重新设计您的查询以一次获取较小的数据块。

// I'm populating an ADO.Net DataTable for this demo but populate whatever object you'd like
DataTable DtFromSQL = new DataTable();
SqlConnection myConnection = new SqlConnection("ConnectionString");
myConnection.Open();
SqlDataReader myReader = null;
SqlCommand myCommand = new SqlCommand("enter some SQL query here", myConnection);
// A CommandTimeout Value of 0 turns the timout off, otherwise you can set it to some value in seconds
myCommand.CommandTimeout = 0;  
myReader = myCommand.ExecuteReader();
DtFromSQL.Load(myReader8);
myConnection.Close();
DtFromSQL;

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

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