I have a site built using asp.net mvc running on IIS 7 using integrated mode. I noticed when I type in mysite.com/test.html I get back The IControllerFactory did not return a controller for a controller named 'test.html'.
What I should have gotten was a 404 error and this should of been served by the IIS7 Static Handler.
Now what I am wondering, does the asp.net mvc handler serve everything? (css, images, zip archives) instead of the static file handler.
If it does then is there a way I can work around this so the Static handler will serve files with extensions. Otherwise this seems like a big performance issue.
Best Answer
By default, ASP.NET MVC will handle all requests, since the routing is designed to handle any paths. You could specifically exclude certain paths by using the
IgnoreRoute
method, like this (in Global.asax):I suspect this will still result in requests going through ASP.NET (though I suspect they'll "fall through" quite quickly). If this is a problem, you could try changing the web.config settings to not pass the requests to ASP.NET at all:
However you'll need to set up exactly which requests you want to go through ASP.NET.