我有一个网络的作用,它提供了在Azure中的网站“只有一个批次可以同时组成”。此站点使用[Import]
属性导入数据存储库。这在大多数情况下工作正常,但在中等负载下,有偶尔的错误,说Currently composing another batch in this ComposablePartExportProvider. Only one batch can be composed at a time
。MEF错误
如何解决这个问题?它在应用程序中已经成为一个相当有问题的瓶颈,并且我确信有一个(相对)快速的修复...我应该注意到我在Nuget中使用了MEF.MVC4
程序集。
我的Global.asax.cs
调用RegisterMef
在Application_Start()
上设置事物的MEF端。我的CompositionContainer
被设置为线程安全的,所以我不知所措。创建策略默认共享,因此设置SatifsyImportsOnce
不会执行任何操作。
完全错误:
Currently composing another batch in this ComposablePartExportProvider. Only one batch can be composed at a time.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Currently composing another batch in this ComposablePartExportProvider. Only one batch can be composed at a time.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Currently composing another batch in this ComposablePartExportProvider. Only one batch can be composed at a time.]
System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.Compose(CompositionBatch batch) +390
MEF.MVC4.MefControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +126
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +81
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +270
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +86
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +12550511
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
是你能解决这个问题? – overslacked
@overslacked - 我们不得不沟通MEF ...... – Faraday