Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Handler mapping on IIS7.5

I'm trying to figure out the meaning of Handler Mapping in IIS7.5 and how IIS use this information to decide who executes what.

For instance I see several entries with the *.aspx path. Which one wins? Could it be that some entries only applies when Classic Pipeline is enabled and some others when Integrated pipeline is used? And the bitness (32 bit, 64bit) influence which entries are considered?

If someone could explain (or have a link explaining) what IIS7.5 does (in terms of "dispatching"/"routing"/"you! take care of that!") when a generic HTTP request comes:

    GET /blabla/dummy.bla HTTP/1.1
    Host: blabla.org

Later on I would be interested in how the IIS Rewrite Module or ARR, works, but for now I'm only interested in the Handle Mapping configuration.

Thank in advance!

like image 784
Eduard Avatar asked Aug 11 '11 16:08

Eduard


1 Answers

Fallow's answer is not quite accurate, handler mappings IIS7 are handled differently from IIS6 script maps.

In IIS7's management console there is an important attribute not shown in the UI, the preCondition attribute.

The preCondition attribute is used to specify when a handler should be invoked. To answer your question:

For instance I see several entries with the *.aspx path. Which one wins? Could it be that some entries only applies when Classic Pipeline is enabled and some others when Integrated pipeline is used? And the bitness (32 bit, 64bit) influence which entries are considered?

Different pre-conditions are used to decide which .aspx handler should be invoked. For example, on a 64 bit system with ASP.NET 2.0 and ASP.NET 4.0 installed there are six possible .aspx handler mappings defined. Each one has a different preCondition rule:

<add name="PageHandlerFactory-ISAPI-4.0_32bit" 
     path="*.aspx" 
     modules="IsapiModule" 
     scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" 
     preCondition="classicMode,runtimeVersionv4.0,bitness32" />

<add name="PageHandlerFactory-ISAPI-4.0_64bit" 
     path="*.aspx"
     modules="IsapiModule" 
     scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" 
     preCondition="classicMode,runtimeVersionv4.0,bitness64" />

<add name="PageHandlerFactory-Integrated-4.0" 
     path="*.aspx" 
     type="System.Web.UI.PageHandlerFactory" 
     preCondition="integratedMode,runtimeVersionv4.0" />

<add name="PageHandlerFactory-Integrated" 
     path="*.aspx" 
     type="System.Web.UI.PageHandlerFactory" 
     preCondition="integratedMode" />

<add name="PageHandlerFactory-ISAPI-2.0" 
     path="*.aspx"
     modules="IsapiModule" 
     scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" 
     preCondition="classicMode,runtimeVersionv2.0,bitness32" />

<add name="PageHandlerFactory-ISAPI-2.0-64" 
     path="*.aspx" 
     modules="IsapiModule" 
     scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" 
     preCondition="classicMode,runtimeVersionv2.0,bitness64" />

If you look at each of the preConditions above they're all slightly different, this is how IIS chooses which handler mapping to execute.

For more information see:

http://www.iis.net/ConfigReference/system.webServer/handlers/add

Also there's a great article which explains handler mappings and their preConditions here:

Achtung! IIS7 Preconditions

like image 115
Kev Avatar answered Oct 14 '22 02:10

Kev