Optimize the performance of your web applications: Don’t use runAllManagedModulesForAllRequests="true”.
In a lot of web applications I’ve seen (and created myself), the
Running these modules for all your dynamic content is fine. However doing the same thing for all your static content is pure overhead and offers no benefits. All your registered HTTP modules run on every request, not just managed requests (e.g. .aspx). This means modules will run on every .jpg, .gif, .css, .html, .pdf etc.
Remark: Some people on StackOverflow mentioned they had errors after removing this section, in that case I suggest installing the following update: http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=5272
runAllManagedModulesForAllRequests is set to true inside the web.config.
In a lot of articles, blog posts and so on… this is mentioned as a good idea. It’s even a default when you create a new ASP. NET MVC application. However last week I was listening to a Hanselminutes podcast with Nathanael Jones where they said that this was really a bad idea and had a negative impact on the overall performance of your web application. <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer>
Running these modules for all your dynamic content is fine. However doing the same thing for all your static content is pure overhead and offers no benefits. All your registered HTTP modules run on every request, not just managed requests (e.g. .aspx). This means modules will run on every .jpg, .gif, .css, .html, .pdf etc.
How can we fix this?
In fact if you are using IIS 7.5 there is not much you need to do, just remove the modules section and you are done.Remark: Some people on StackOverflow mentioned they had errors after removing this section, in that case I suggest installing the following update: http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=5272