I've set up an ASP.NET MVC RC2 application to use a custom controller factory backed by a CommonServiceLocator (using StructureMap). Routing to and instantiating controllers works fine, but for some reason I'm getting exceptions when trying to access .js, .jpg, or any other static file.
Here's the ControllerFactory code:
public class CommonServiceLocatorControllerFactory : DefaultControllerFactory
{
protected override IController GetControllerInstance(Type controllerType)
{
return (controllerType == null) ?
base.GetControllerInstance(controllerType) :
ServiceLocator.Current.GetInstance(controllerType) as IController;
}
}
And the exception is:
The controller for path '/someimage.jpg' could not be found or it does not implement IController.
How can I get the factory or routing engine to bypass the controller factory?
Note: I'll be using IIS7/Integrated Mode, but the error occurs with the built in web server for VS2K8.