Как исправить "тайм-аут операции ожидания"?
Я вызываю хранимую процедуру с помощью entity framework. Но я испытываю ниже упомянутый ответ от сервера.
Вот код
foreach (var item in re.GetProgramScheduleTimeOverlap(StartDate, EndDate, StationId)) { double dstStartMinutes = (double)item.DstMinutes; double dstEndMinutes = (double)item.DstEndMinutes; tg.Add(new TimeGap { strTime = GetDateWithStartEndTime(item.StartDateTime.AddMinutes(dstStartMinutes), item.EndDateTime.AddMinutes(dstEndMinutes), Convert.ToInt16(timeZoneOffset)), longTime = UTCDateHelper.GetLocalDate(item.EndDateTime.AddMinutes(dstEndMinutes), Convert.ToInt16(timeZoneOffset)).Date.ToString("MM/dd/yyyy"), endDateTime = item.EndDateTime.AddMinutes(dstEndMinutes), startDateTime = item.StartDateTime.AddMinutes(dstStartMinutes) }); }
Here is 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) +1787962 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5341966 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +546 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1693 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.ExecuteDbDataReader(CommandBehavior behavior) +41 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10 System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +427 [EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.] System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +497 System.Data.Objects.ObjectContext.CreateFunctionObjectResult(EntityCommand entityCommand, ReadOnlyMetadataCollection`1 entitySets, EdmType[] edmTypes, MergeOption mergeOption) +150 System.Data.Objects.ObjectContext.ExecuteFunction(String functionName, MergeOption mergeOption, ObjectParameter[] parameters) +315 System.Data.Objects.ObjectContext.ExecuteFunction(String functionName, ObjectParameter[] parameters) +57 Radius.Entity.RadiusEntities.GetProgramScheduleList_V2(Nullable`1 startDate, Nullable`1 endDate, Nullable`1 stationId) in d:\Vijay\Clients\David\EPG Interface\Radius.Entity\Radius.Designer.cs:2973 Radius.Scheduler.SchedulerService.GetProgramSchedule(DateTime StartDate, DateTime EndDate, Int64 StationId, IList`1 tg) in d:\Vijay\Clients\David\EPG Interface\Radius.Scheduler\SchedulerService.cs:807 Radius.Scheduler.SchedulerService.CheckTimeOverLapWeekday(DateTime startsOn, Nullable`1 endsDate, SchedulerModel sm, Int64 StationId) in d:\Vijay\Clients\David\EPG Interface\Radius.Scheduler\SchedulerService.cs:316 Radius.Controllers.ProgramScheduleController.CheckTimeOverlap(SchedulerModel sm) in d:\Vijay\Clients\David\EPG Interface\Radius\Controllers\ProgramScheduleController.cs:1471 lambda_method(Closure , ControllerBase , Object[] ) +104 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +211 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253 System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +21 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +189 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324 System.Web.Mvc.Controller.ExecuteCore() +105 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +90 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +34 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +48 System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9651516 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Что я уже пробовал:
Я попытался проверить журналы сервера баз данных. Я сократил количество обращений к хранимой процедуре, но все равно проблема не решается.
[no name]
Увеличьте время ожидания команды или профилируйте запрос и посмотрите, что занимает так много времени.