English 中文(简体)
两辆汽车集装箱在单一纤维中竞争
原标题:Two Autofac containers competing in a single webrequest

A bit of a strange situation: I m developing an ASP.NET MVC 3 application that uses Autofac as its IoC container and that can be dropped into any existing MVC or WebForms application.

Everything works fine, except when the other application also uses Autofac. I ve created a custom DependencyResolver wrapper that combines my application s AutofacDependencyResolver with DependencyReolver.Current of the other application (when set). Resolving of components just fails sometimes although I can see in the debugger that everything is properly registered.

我怀疑,这两种内部解决者都在争夺HttpContext的一个地点。 收集物品,但我可以追随具体问题。

如何妥善处理这种情况?

问题回答

你可以把该组合分成一个单元。 当你将一个申请纳入另一个申请时,该模块即登记。





相关问题
Registering Collections in Autofac 2.1.10 RC

I am upgrading code from Autofac 1.4 to 2.1.10 Release Candidate. My module previously performed registration like this: builder.RegisterCollection<IExceptionHandler>() .As<...

How to carry out custom initialisation with autofac

I m adding autofac to an existing project and some of the service implementations require their Initialize method to be called and passed configuration information. Currently I m using the code: ...

Autofac doesn t like MVC Source

I added the ASP.NET MVC 2 RC2 source code to my solution (using these instructions: http://blog.stevensanderson.com/2009/02/03/using-the-aspnet-mvc-source-code-to-debug-your-app/), but now it won t ...

IOC/Autofac container

I am currently using Autofac, but am open to commentary regarding other IOC containers as well. I would prefer a solution using Autofac if possible. I am also somewhat new to IOC so I may be grossly ...

Dependency Injection for Presenter

I have a Presenter that takes a Service and a View Contract as parameters in its constructor: public FooPresenter : IFooPresenter { private IFooView view; private readonly IFooService service;...

热门标签