ASP.NET MVC tries to use ControllerFactory to load resources?
I've created a controller factory to be able to use Unity to resolve controller dependencies. I get the following error:
The IControllerFactory 'M开发者_开发技巧y.Name.Space.MyControllerFactory' did not return a controller for the name 'favicon.ico'.
Why does it try to use the controller factory to load resources and why doesn't it return 404 when the resource is not found?
You could add the following to your routes:
routes.IgnoreRoute("favicon.ico");
public class ControllerFactory : DefaultControllerFactory
{
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
if (controllerType == null)
return null;
[...]
}
}
Tells the factory to use the default handling.
精彩评论