Unity: The type InjectionPolicy cannot be constructed.
This is a puzzle I've been struggling with for hours. Here's the background:
We use Unity IoC in an MVC4 web app
We have a couple ApiControllers (IHttpController) and a bunch of regular
controllers (IController)
Resolution of the IControllers works fine
Resolution of the IHttpControllers has been working fine for months and
now fails with the a type resolution error having the details "The type
InjectionPolicy cannot be constructed. You must configure the container to
supply this value"
Both the regular and Api controllers take an ICustomerService dependency
which has an ICustomerRepository dependency which in turn has an IClient
dependency, but none of this is new or different.
Removing the ICustomerService dependency from the ApiController solves the
problem (but that interface is clearly configured and working everywhere
else)
We have in place an HttpControllerActivator that is registered in Unity
and is intercepting calls to resolve the IHttpControllers - it fails on
container.Resolve, even though looking into the container, the controller
is clearly there.
I have searched on this particular error and find nothing. Has anyone seen
it before or does it give you any clues as to what might be going on?
Thanks so much!
No comments:
Post a Comment