Receive error: an instance of IControllerFactory was found in the resolver, as well as the user registered provider

We encounter the following error in some of our environments, apparently after reusing the application pool.

An instance of IControllerFactory was found in resolver, as well as a custom registered provider in ControllerBuilder.GetControllerFactory. Please install only one or the other.

We do not use ControllerBuilder to register our factory controller, only IDependencyResolver, as indicated in this blog

We use Castle Windsor (seemingly unconnected) as our container, and in Application_Start from Global.asax, first registering all our dependencies and calling the following to register IDepencencyResolver.

DependencyResolver.SetResolver(new WindsorDependencyResolver(IoC)); 

What can cause this exception? Any help would be appreciated.

+7
source share
2 answers

Using MVC DependencyResolver with Castle Windsor is not recommended because it has a design flaw: it does not free service instances if necessary. See article article for a full explanation.

Instead, use the method illustrated in the Windsor documentation , which uses a custom factory to embed dependencies in controllers.

0
source

For information, I had the same error message (with ninject). I don’t understand why, because the application started working on another machine. I tried to clear the caches ... but the error was still present. I redid the check in my repository and everything was fine ...

0
source

All Articles