Question

I have an ASP.NET MVC application that is hosted on Windows Azure and all the static files served from the website are being processed by ASP.NET. Is there a way to get IIS to serve the static files directly and not route those requests through ASP.NET? I'm looking to help improve the performance of returning those static files from the server.

I'm not sure if this is something that ASP.NET MVC itself does, or if it's because of the fact that I'm hosting it on Azure.

UPDATE: The main reason I'm looking to do this is because the static files are processed by all HttpModules registered in the application, thus slowing performance some.

Was it helpful?

Solution

When used in IIS 7 Integrated mode all requests go through the managed pipeline. It is sufficiently optimized and not something that you should worry about. On the other hand if you notice that those static files are intercepted by the ASP.NET routing engine of your application you could try adding them as IgnoreRoute definitions in your Global.asax.

OTHER TIPS

I removed the "runAllManagedModulesForAllRequests='true'" definition in the web.config and added "preCondition='managedHandler" to the HttpModule registrations that I don't want to execute for static content.

I also implemented Darin's answer.

Not entirely what I was looking for, but it seems to fit the bill.

UPDATE: if you remove "runAllManagedModulesForAllRequests=true" from web.config, make sure your IIS is up to date, otherwise extensionless URIs won't work anymore. KB about that: http://support.microsoft.com/kb/980368/en-us

(Of course, even if you keep that option, your should worry about your server being up to date.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top