开发者

How to prevent ASP.NET MVC from handling Static files (js and images) on Windows Azure?

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 so开发者_运维知识库mething 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.


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.)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜