.net - 了解 IIS7.5 上的处理程序映射

标签 .net asp.net iis-7.5

我试图弄清楚 IIS7.5 中处理程序映射的含义以及 IIS 如何使用此信息来决定谁执行什么。

例如,我看到几个带有 *.aspx 路径的条目。哪一个获胜?是否某些条目仅在启用经典管道时适用,而另一些条目仅在使用集成管道时适用?位数(32 位、64 位)会影响哪些条目被考虑?

如果有人可以解释(或有一个链接解释)当通用 HTTP 请求到来时 IIS7.5 的作用(就"dispatch"/“路由”/“你!照顾好它!”而言):

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

稍后我会对 IIS 重写模块或 ARR 如何工作感兴趣,但现在我只对句柄映射配置感兴趣。

提前致谢!

最佳答案

Fallow's answer不太准确,IIS7 处理程序映射的处理方式与 IIS6 脚本映射不同。

在 IIS7 的管理控制台中,有一个重要的属性未显示在 UI 中,即 preCondition 属性。

preCondition 属性用于指定何时调用处理程序。回答您的问题:

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?

使用不同的前置条件来决定应调用哪个 .aspx 处理程序。例如,在安装了 ASP.NET 2.0 和 ASP.NET 4.0 的 64 位系统上,定义了六种可能的 .aspx 处理程序映射。每个都有不同的前提条件规则:

<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" />

如果您查看上面的每个前提条件,它们都略有不同,这就是 IIS 选择要执行的处理程序映射的方式。

更多信息请参见:

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

还有一篇很棒的文章解释了处理程序映射及其先决条件:

Achtung! IIS7 Preconditions

关于.net - 了解 IIS7.5 上的处理程序映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7029441/

相关文章:

.net - 防止 Visual Studio 中断未处理的异常

c# - 在间隔异步中并行运行一些函数?

jquery - 最佳实践 : How to configure jQuery UI with ASP. NET

asp.net - Azure站点: Compiler Error Message: CS1056: Unexpected character '$'

asp.net-mvc-2 - ASP.NET MVC 2 应用程序在 VS 中运行,但在 IIS 上出错

c# - 保持控件在窗体中的大小和位置

javascript - View 和 Controller mvc5 之间的双向数据绑定(bind)

jquery - 无法获取下拉选择的值

windows - 为什么使用IIS7.5的Microsoft.Web.Management.dll只能在64位进程中使用?

c# - 从 VS2010 调试在远程 IIS 服务器上运行的 ASP.NET 应用程序