asp.net中的Httphandler永远不会被调用

本文关键字:调用 永远 net 中的 Httphandler asp | 更新日期: 2023-09-27 17:50:20

我有一个web应用程序在。net framework 2.0中运行,托管在IIS 7.5上。应用程序池以经典模式运行。我想拦截所有包含。txt文件的请求。下面是我在web.config

中的条目
<system.webServer>
     <validation validateIntegratedModeConfiguration="false"/>  
    <handlers>
        <add name="NES.HiLo.Security.CommunityResource, NES.HiLo.Security" verb="*"  path="*.txt" type="NES.HiLo.Security.CommunityResource, NES.HiLo.Security"  />
    </handlers>
</system.webServer>
<httpHandlers>
<add verb="*" path="*.txt" type="NES.HiLo.Security.CommunityResource, NES.HiLo.Security"  />
</httpHandlers>

当我请求像

这样的URL时
http://local.mysite.com/media/CLT/ResourceUploads/1000277/Test1.txt

处理程序永远不会启动,控件永远不会进入处理程序的代码中。

你知道我错过了什么吗?由于

asp.net中的Httphandler永远不会被调用

根据在IIS 7.0中以经典模式注册处理程序的MSDN示例,您缺少几个属性:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>  
    <handlers>
        <add name="CommunityResourceHandler" verb="*" path="*.txt"
             type="NES.HiLo.Security.CommunityResource, NES.HiLo.Security"
             modules="IsapiModule" 
             scriptProcessor="FrameworkPath'aspnet_isapi.dll"
             resourceType="File" />
    </handlers>
</system.webServer>
<httpHandlers>
    <add verb="*" path="*.txt" type="NES.HiLo.Security.CommunityResource, NES.HiLo.Security" />
</httpHandlers>