jgauffin
jgauffin

Reputation: 101150

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 'My.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?

Upvotes: 1

Views: 1272

Answers (2)

jgauffin
jgauffin

Reputation: 101150

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.

Upvotes: 2

Darin Dimitrov
Darin Dimitrov

Reputation: 1038770

You could add the following to your routes:

routes.IgnoreRoute("favicon.ico");

Upvotes: 4

Related Questions