I have a module in an ASP.NET MVC application. The module works fine, but it starts for each type of file, including static content, although I have:
<modules runAllManagedModulesForAllRequests="false"> <add name="MyModule" ... / > </modules>
The module hooks the AcquireRequestState and PostRequestHandlerExecute events, and both show a static content trigger (.htm, .css, .png, etc.).
I got the impression that runAllManagedModulesForAllRequests = "false" should contain modules for crawling nonASP.NET content.
To clarify:
I can set preCondition = "managedHandler" as follows:
<add name="MyModule" type="MyApp.MyModule" preCondition="managedHandler" />
and get my module to run only managed requests.
However, I am trying to understand why the IIS pipeline as a whole runs remote remote modules for each request. I think this worked very well in older versions, unless runAllManagedModulesForAllRequests = "true" did not run unmanaged content in ASP.NET modules.
Runs on IIS8 in 64-bit mode of Windows 8 with integrated pipeline mode.
Update:
After several more studies, it turns out that the following is true:
- if runAllManagedModulesForAllRequests = "true" of all modules - regardless of whether the preCondition attribute is set for all requests. This is also true for implementing Application_XXXX events in HttpApplication
- runAllManagedModulesForAllRequests = "false" does not affect unmanaged requests from remote modules unless preCondition = "managedHandler" is set
- runAllManagedModulesForAllRequests = "false" affects Application_XXXX events, as a result of which these events fire only managed requests. IOW, Application_XXXX behaves as if preCondition = "managedHandler" was in the implementation of the "module"
For more information on this, I posted a blog entry: http://www.west-wind.com/weblog/posts/2012/Oct/25/Caveats-with-the-runAllManagedModulesForAllRequests-in-IIS-78
source share