Reputation: 2979
I'm using custom controller factory with unity to create a controller instances. My factory looks like:
public class UnityControllerFactory : DefaultControllerFactory
{
public override IController CreateController(RequestContext requestContext, string controllerName)
{
return IoC.Container.Resolve<BaseController>(controllerName + "Controller");
}
....
When I'm debugging this code it is trying to resolve ContentController (controllerName == "Content"), wich is of course not registered in my unity configuration file. I have tried to find if the ContentController exists somewhere in the System.Web.MVC, but I didnt find it.
Can somebody explain to me, why this factory is trying to resolve this controller?
thanks
Upvotes: 0
Views: 247
Reputation: 73123
This is a guess, but it sounds like static content from your website in the Content
folder (e.g images, css, etc) is being served via MVC, when it shouldn't.
What server are you using? If your using IIS 7 or IIS Express, it should used the managed pipeline and thus requests of these types shouldn't even get to the MVC runtime.
Try digging deeper into the requestContext
instance to see exactly what is requesting this controller.
Upvotes: 1