了解 IIS7.5 上的處理程序映射
我試圖弄清楚 IIS7.5 中處理程序映射的含義以及 IIS 如何使用這些資訊來決定誰執行什麼。
例如,我看到幾個帶有 *.aspx 路徑的條目。哪一個贏了?會不會是某些條目僅在啟用經典管道時才適用,而其他條目僅在使用集成管道時適用?位數(32 位、64 位)會影響考慮哪些條目?
如果有人可以解釋(或有一個連結解釋)IIS7.5 在通用 HTTP 請求到來時做了什麼(就“調度”/“路由”/“你!照顧那個!”):
GET /blabla/dummy.bla HTTP/1.1 Host: blabla.org稍後我會對 IIS 重寫模組或 ARR 的工作原理感興趣,但現在我只對句柄映射配置感興趣。
預先感謝!
Fallow 的回答不太準確,處理程序映射 IIS7 的處理方式與 IIS6 腳本映射不同。
在 IIS7 的管理控制台中,有一個 UI 中沒有顯示的重要屬性,即
preCondition屬性。該
preCondition屬性用於指定何時應呼叫處理程序。要回答您的問題:例如,我看到幾個帶有 *.aspx 路徑的條目。哪一個贏了?會不會是某些條目僅在啟用經典管道時才適用,而其他條目僅在使用集成管道時適用?位數(32 位、64 位)會影響考慮哪些條目?
不同的前置條件用於決定
.aspx應該呼叫哪個處理程序。例如,在安裝了 ASP.NET 2.0 和 ASP.NET 4.0 的 64 位系統上,.aspx定義了六種可能的處理程序映射。每個人都有不同的preCondition規則:<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" />如果您查看
preConditions上述每一項,它們都略有不同,這就是 IIS 選擇執行哪個處理程序映射的方式。有關更多資訊,請參閱:
http://www.iis.net/ConfigReference/system.webServer/handlers/add
還有一篇很棒的文章解釋了處理程序映射及其
preConditions在這裡: