Asp.net web.config. What if anything does an empty

2019-06-24 06:52发布

问题:

I picked this up on sample code:

<remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" 
           type="System.Web.Routing.UrlRoutingModule" 
           preCondition="" />

What does the empty precondition do if anything?

回答1:

An empty preCondition means that a module or handler will always be executed regardless of the .NET runtime version, "bitness" of the application pool, whether the code is managed or not or any other applicable filtering conditions that can be applied.

If the preCondition is applied to a handler then other filtering conditions come into play as well such as the path and verb attributes to determine if the handler is executed.

For more information about pre-conditions see:

Achtung! IIS7 Preconditions