Тупик в System.Component.TypeDescriptor [закрыт]

Я потратил много времени (поиск в Google, отражение бинарных файлов .net и т. Д.), Пытаясь решить следующую проблему:

Я вижу тупик в нашем приложении (ASP.NET MVC + EF4). У нас есть несколько контекстов EF, которые создаются в начале запроса и удаляются в конце. Иногда мы имеем следующую ситуацию: ASP.NET создает поток для каждого запроса, а затем поток переходит в состояние «в соединении или в спящем режиме» при доступе к контексту EF.

Большинство заблокированных потоков имеют трассировку стека следующим образом:

    System.dll!System.ComponentModel.TypeDescriptor.Refresh(object component, bool refreshReflectionProvider) + 0x97 bytes    
    System.Data.dll!System.Data.SqlClient.SqlCommand.DesignTimeVisible.set(bool value) + 0x22 bytes    
    System.Data.dll!System.Data.SqlClient.SqlCommand.SqlCommand(System.Data.SqlClient.SqlCommand from) + 0xc9 bytes    
    System.Data.dll!System.Data.SqlClient.SqlCommand.Clone() + 0x27 bytes    
    System.Data.dll!System.Data.SqlClient.SqlCommand.System.ICloneable.Clone() + 0x9 bytes    
    System.Data.Entity.dll!System.Data.Common.DbCommandDefinition.CreateCommandDefinition(System.Data.Common.DbCommand prototype) + 0x47 bytes    
    System.Data.Entity.dll!System.Data.SqlClient.SqlProviderServices.CreateDbCommandDefinition(System.Data.Common.DbProviderManifest providerManifest, System.Data.Common.CommandTrees.DbCommandTree commandTree) + 0x21 bytes    
    System.Data.Entity.dll!System.Data.EntityClient.EntityCommandDefinition.EntityCommandDefinition(System.Data.Common.DbProviderFactory storeProviderFactory, System.Data.Common.CommandTrees.DbCommandTree commandTree) + 0x2a1 bytes    
    System.Data.Entity.dll!System.Data.EntityClient.EntityProviderServices.CreateDbCommandDefinition(System.Data.Common.DbProviderManifest providerManifest, System.Data.Common.CommandTrees.DbCommandTree commandTree) + 0x8e bytes    
    System.Data.Entity.dll!System.Data.Objects.Internal.ObjectQueryExecutionPlan.Prepare(System.Data.Objects.ObjectContext context, System.Data.Common.CommandTrees.DbQueryCommandTree tree, System.Type elementType, System.Data.Objects.MergeOption mergeOption, System.Data.Objects.Span span, System.Collections.ObjectModel.ReadOnlyCollection<System.Collections.Generic.KeyValuePair<System.Data.Objects.ObjectParameter,System.Data.Objects.ELinq.QueryParameterExpression>> compiledQueryParameters) + 0x113 bytes    
    System.Data.Entity.dll!System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(System.Data.Objects.MergeOption? forMergeOption) + 0x310 bytes    
    System.Data.Entity.dll!System.Data.Objects.ObjectQuery<CompuTool.Business.Portal.Desktop>.GetResults(System.Data.Objects.MergeOption? forMergeOption) + 0x55 bytes    
    System.Data.Entity.dll!System.Data.Objects.ObjectQuery<System.__Canon>.System.Collections.Generic.IEnumerable<T>.GetEnumerator() + 0x2f bytes    
    System.Core.dll!System.Linq.Enumerable.SingleOrDefault<CompuTool.Business.Portal.Desktop>(System.Collections.Generic.IEnumerable<CompuTool.Business.Portal.Desktop> source) + 0x10f bytes    
    System.Core.dll!System.Linq.Queryable.SingleOrDefault<CompuTool.Business.Portal.Desktop>(System.Linq.IQueryable<CompuTool.Business.Portal.Desktop> source, System.Linq.Expressions.Expression<System.Func<CompuTool.Business.Portal.Desktop,bool>> predicate) + 0x24e bytes    
>    CompuTool.Presentation.Web.dll!CompuTool.Presentation.Web.Controllers.DesktopStateController.ValidateRequest(CompuTool.Business.Portal.DesktopManagerContext dataContext, CompuTool.Business.Portal.User user, int desktopId) Line 30 + 0x19e bytes    C#
    CompuTool.Presentation.Web.dll!CompuTool.Presentation.Web.Controllers.DesktopStateController.SetDesktopState(CompuTool.Business.Portal.User user, int desktopId, string value) Line 65 + 0x17 bytes    C#
    CompuTool.Presentation.Web.dll!CompuTool.Presentation.Web.Controllers.DesktopStateController.Set(int desktopId, string value) Line 111 + 0x13 bytes    C#
    [Lightweight Function]    
    System.Web.Mvc.dll!System.Web.Mvc.ReflectedActionDescriptor.Execute(System.Web.Mvc.ControllerContext controllerContext, System.Collections.Generic.IDictionary<string,object> parameters) + 0x108 bytes    
    System.Web.Mvc.dll!System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionDescriptor actionDescriptor, System.Collections.Generic.IDictionary<string,object> parameters) + 0x27 bytes    
    System.Web.Mvc.dll!System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters.AnonymousMethod__12() + 0x81 bytes    
    System.Web.Mvc.dll!System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(System.Web.Mvc.IActionFilter filter, System.Web.Mvc.ActionExecutingContext preContext, System.Func<System.Web.Mvc.ActionExecutedContext> continuation) + 0xe6 bytes    
    System.Web.Mvc.dll!System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(System.Web.Mvc.ControllerContext controllerContext, System.Collections.Generic.IList<System.Web.Mvc.IActionFilter> filters, System.Web.Mvc.ActionDescriptor actionDescriptor, System.Collections.Generic.IDictionary<string,object> parameters) + 0x13a bytes    
    System.Web.Mvc.dll!System.Web.Mvc.ControllerActionInvoker.InvokeAction(System.Web.Mvc.ControllerContext controllerContext, string actionName) + 0x15f bytes    
    System.Web.Mvc.dll!System.Web.Mvc.Controller.ExecuteCore() + 0x9f bytes    
    System.Web.Mvc.dll!System.Web.Mvc.ControllerBase.Execute(System.Web.Routing.RequestContext requestContext) + 0x14f bytes    
    System.Web.Mvc.dll!System.Web.Mvc.MvcHandler.BeginProcessRequest.AnonymousMethod__5() + 0x3e bytes    
    System.Web.Mvc.dll!System.Web.Mvc.Async.AsyncResultWrapper.MakeVoidDelegate.AnonymousMethod__0() + 0x14 bytes    
    System.Web.Mvc.dll!System.Web.Mvc.MvcHandler.EndProcessRequest.AnonymousMethod__d() + 0x36 bytes    
    System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() + 0x1d5 bytes    
    System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously) + 0x177 bytes    
    System.Web.dll!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception error) + 0x6f5 bytes    
    System.Web.dll!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext context, System.AsyncCallback cb) + 0x85 bytes    
    System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context) + 0x2b6 bytes    
    System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr managedHttpContext, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) + 0x3bf bytes    
    System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr managedHttpContext, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) + 0x22 bytes    
    [Native to Managed Transition]    
    [Managed to Native Transition]    
    System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr managedHttpContext, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) + 0x4f4 bytes    
    System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr managedHttpContext, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) + 0x22 bytes 

Эта проблема связана с неправильным использованием контекстов Entity Framework? Спасибо за помощь.

Ответы на вопрос(0)

Ваш ответ на вопрос