我们正面临来自Entity Framework的以下问题,并且它发生在应用程序的高峰时段,
以下是例外情况详细信息
System.InvalidOperationException:ExecuteReader需要打开且可用的Connection。连接的当前状态为打开。
在System.Data.SqlClient.SqlConnection.GetOpenConnection(字符串方法)
在System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String方法,SqlCommand命令)
在System.Data.SqlClient.SqlCommand.ValidateCommand(String方法,布尔异步)上
在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String方法,TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
1.Dispatch [TTarget,TInterceptionContext,TResult](TTarget目标,Func
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher3 operation, TInterceptionContext interceptionContext, Action
3执行,操作3 executed)
1.b__64()
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryInternal[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object[] parameters)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass65
在System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction [T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
1.b__63()
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass65
在System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute [TResult](Func1 operation)
1.MoveNext()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryReliably[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object[] parameters)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQuery[TElement](String commandText, ExecutionOptions executionOptions, Object[] parameters)
at System.Data.Entity.Internal.LazyEnumerator
在System.Linq.Enumerable.FirstOrDefault [TSource](IEnumerable`1源)上
在Telematics.BusinessServices.ErrorService.GetErrorCode(字符串serviceName,字符串operationName,字符串errorType,Int32 errorIndicator)
在ApiServices.Common.ErrorHandler.ErrorHandlerAttribute.HandleGeneralException(ErrorResponse&errorInfo,IErrorService errorService,字符串serviceName,字符串exceptionMessage,HttpStatusCode&statusCode,字符串operationType)
在ApiServices.Common.ErrorHandler.ErrorHandlerAttribute.OnException(HttpActionExecutedContext actionExecutedContext)