<modules runAllManagedModulesForAllRequests="true" /> Meaning
Asked Answered
B

1

150

I wanted to know what is the meaning of

<modules runAllManagedModulesForAllRequests="true" />

I am using IIS 7.5 and I have a simple web application. Do I need to write this in my web.config file. I have also written few http handler for jquery ajax call. I am using form authentication and asp.net 4.0.

How can I determine which module I have to run and which is not to be?

Blouse answered 15/6, 2012 at 10:22 Comment(0)
D
131

Modules Preconditions:

The IIS core engine uses preconditions to determine when to enable a particular module. Performance reasons, for example, might determine that you only want to execute managed modules for requests that also go to a managed handler. The precondition in the following example (precondition="managedHandler") only enables the forms authentication module for requests that are also handled by a managed handler, such as requests to .aspx or .asmx files:

<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" preCondition="managedHandler" />

If you remove the attribute precondition="managedHandler", Forms Authentication also applies to content that is not served by managed handlers, such as .html, .jpg, .doc, but also for classic ASP (.asp) or PHP (.php) extensions. See "How to Take Advantage of IIS Integrated Pipeline" for an example of enabling ASP.NET modules to run for all content.

You can also use a shortcut to enable all managed (ASP.NET) modules to run for all requests in your application, regardless of the "managedHandler" precondition.

To enable all managed modules to run for all requests without configuring each module entry to remove the "managedHandler" precondition, use the runAllManagedModulesForAllRequests property in the <modules> section:

<modules runAllManagedModulesForAllRequests="true" />    

When you use this property, the "managedHandler" precondition has no effect and all managed modules run for all requests.

Copied from IIS Modules Overview: Preconditions

Desmoid answered 15/6, 2012 at 10:31 Comment(7)
is it good to run all the models for all the request or I shall be more specific over there. Does this affect the speed of the application?Malissa
Yes there will be performance issue. You should use precondition instead.Desmoid
then how should I decide which module I have to use and which to not.Malissa
A follow-up question. I see it's possible to enable seperate modules as well, in stead of all. See my question (#20999316), the solution there was to add <modules runAllManagedModulesForAllRequests="true">. But I see now it might create overhead. So, is there a specific module responsible that I can enable to get the dot "." in MVC WebAPI Url, in stead of just enabling them all with <modules runAllManagedModulesForAllRequests="true">? Is it for example the "UrlAuthorization" module?Weighbridge
adding the modules tag section works for me. I use MVC 5, .net framework 4.5.0, IIS 7 and windows server 2008Misfeasance
For whatever reason this doesn't work for me. IIS Express.Fenestra
IIS [Express] shows 404-Not-Found with some ugly html, with that setting on, for requests with dot or plus characters (not url-encoded) as the part of the last url-segment not followed by a slash-character. I do realize that such path resembles a potential file-path, but that makes that setting a lie: such request never makes it to the application.Ebro

© 2022 - 2024 — McMap. All rights reserved.