c# - MEF error "Only one batch can be composed at a time" -


I have a web-roll that works on a website in Azure This site uses the < Code> [import] attribute. It works fine for most part, but under a moderate load, there are errors sometimes that say that is currently composing another batch in this ComposablePartExportProvider. Only one batch can be created at one time .

How do I fix this error? It has become a rather problematic bottleneck in the application, and I'm sure there is not one (relatively) quick improvement ... I think I use the MEF.MVC4 in Nuget assembly I should be paying attention.

> To set the MEF side of things on my Global.asax.cs call RegisterMef Application_Start () .

  public static void Register ((var container = Configure container ()); Kantrolrbilder. Currently Kset Niyntrkficret (new Mef Kantrolrfactor (container)), Global Configuration. Configuration. Dependence Rijholr = new Mafdysenness Resor (Container);} Private Static Composition Container Configurable Container () {var Assembly = New Assembly Assembly (Assembly.GetExecutingAssembly ()); Var Container = New Composition Editor (Assembly, True); Suspicious Container;}  

My Constructor Thread is safe, so I'm in damaged Construction policy, if shared by default, install SatifsyImportsOnce Nothing will happen

complete error:.

  ComposablePartExportProvider compose another batch in this one. Only one batch can be created at one time. : An uncontrolled exception occurred during the execution of the current web request. Please error About review the stack trace for more information and code where did it all originate from. Exception Details: System.InvalidOperationException: is currently making another batch in the ComposablePartExportProvider. Only one batch can be made at one time. Source error: An unrestricted exception was encountered during the execution of the current web request. The information about the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [Amanyopreshn exception is currently making another batch in the compose qualified PARTExportProvider. Only one batch can create at a time.] System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.Compose (CompositionBatch batch) +390 MEF.MVC4.MefControllerFactory.GetControllerInstance (RequestContext requestContext, type controller type) +126 System.Web.Mvc . DefaultControllerFactory.CreateController (requestContext requestContext, string controllerName) +81 System.Web.Mvc.MvcHandler.ProcessRequestInit (HttpContextBase HttpContext, IController & amp; Controller, IControllerFactory & Factory) 270 System.Web.Mvc.MvcHandler.BeginProcessRequest (HttpContextBase HttpContext , AsyncCallback callback, object state) +86 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () 12,550,511 System.Web.HttpApplication.ExecuteStep (IExecutionStep step, Boolean & amp; completedSynchronously) 288  

I have the solution to this problem is to not use MEF.MVC4 because maybe there is an error in its implementation H Medium weight (ex: 100 user requests at the same time). I MEF2

Use Application_Start ()

  var list = new AggregateCatalog (New DirectoryCatalog ( "owner")); Var container = new creation resource (catalog, true); Controllerbuilder Current .set Controller Fitrette (New Mef Controller Factor (Container)); Global Configuration Configuration. Dependency Resolver = New MefdaSpensi Resiler (Container); CurrentContainer.SetCurrentContainer (Container);  

Comments