请帮助从Stack Strace下面找出异常原因:
Error=Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.,
StackTrace = at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Core.ResService.DataAccess.SQLHelper.ExecuteNonQuery(SqlConnection conn, SqlTransaction trans, CommandType cmdType, String cmdText, SqlParameter[] cmdParms)
at Core.ResService.DataAccess.ReservationDal.SelectActiveResXml(Int32 resvID, String sessionID)
at Core.ResService.BusinessLogic.Reservation.SelectActiveReservation(Int32 hotelID, Int32 resvID, String sessionID)
关于上述异常堆栈的任何想法都会像可能的解决方案一样,并且会引起关注。
答案 0 :(得分:1)
它会在堆栈跟踪中告诉您。您的SQL调用超时。修复SQL调用或增加超时。命令对象上有一个超时属性,但你应该真正修复你的SQL。