繁体   English   中英

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

[英]httphandler in asp.net never gets called

我有一个运行在.net framework 2.0中并托管在IIS 7.5上的Web应用程序。 应用程序池以经典模式运行。 我想拦截所有包含.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>

当我向网址发出请求时

http://local.mysite.com/media/CLT/ResourceUploads/1000277/Test1.txt

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

有什么想法我想念的吗? 谢谢

根据MSDN在经典模式下在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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM