问题映射的HttpHandler - > HTTP错误404未找​​到 [英] Problem mapping HttpHandler --> HTTP Error 404 Not Found

查看:298
本文介绍了问题映射的HttpHandler - > HTTP错误404未找​​到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有试图映射在web.config一个HttpHandler的问题。

这是相关的配置位:

 <&HttpHandlers的GT;
  <添加动词=*路径=* hndlr。TYPE =MyAssembly.MyHandler,MyAssembly程序验证=FALSE/>
< / HttpHandlers的>

当我浏览到 HTTP://localhost/myApp/whatever.hndlr 我收到了服务器错误404(未找到)

这是第1次,我挂接一个HttpHandler所以我可能失去了一些东西 - 任何帮助AP preciated

更新

我设法得到它的工作使用这两种答案为止 - 谁是能够exaplin为什么它得到的答案标记

这是我的配置(如果没有这两个将无法正常工作 - 我正在运行的在经典模式下IIS7

的System.Web:

 <&HttpHandlers的GT;
    <添加动词=*路径=* MyHandler.hndlrTYPE =MyAssembly.MyAssemblyHandler,MyAssembly程序验证=FALSE/>
< / HttpHandlers的>

System.webserver:

 <&处理GT;
    <添加名称=MyHandler的动词=*路径=* MyHandler.hndlrTYPE =MyAssembly.MyAssemblyHandler,MyAssembly程序验证=false的模块=IsapiModulescriptProcessor ​​=C:\\ WINDOWS \\微软。 NET \\框架\\ V2.0.50727 \\ ASPNET_ISAPI.DLL= resourceType为未指定requireAccess =脚本/>
< /处理器>


解决方案

您使用IIS7,如果是的话是应用程序池经典或流水线模式下运行?如果它是IIS7在流水线模式,则该处理程序参照需要进入下面的部分

 < system.webServer>
    <&处理GT;
    < /处理器>
< system.webServer>

,而不是在下面的部分。

 <&的System.Web GT;
    <&HttpHandlers的GT;
    < / HttpHandlers的>
< /system.web>

I am having problems trying to map an HttpHandler in the web.config.

This is the relevant config bit:

<httpHandlers>
  <add verb="*" path="*.hndlr" type="MyAssembly.MyHandler, MyAssembly" validate="false" />
</httpHandlers>

When I navigate to http://localhost/myApp/whatever.hndlr I am getting a server error 404 (not found).

It's the 1st time I am hooking up an HttpHandler so I might be missing something - any help appreciated!

UPDATE:

I managed to get it working using both answers so far - who's able to exaplin why it works gets the answer marked!

This is my config (won't work if Don't have both - I am running IIS7 in classic mode)

System.web:

<httpHandlers>
    <add verb="*" path="*MyHandler.hndlr" type="MyAssembly.MyAssemblyHandler, MyAssembly" validate="false"/>
</httpHandlers>

System.webserver:

<handlers>
    <add name="MyHandler" verb="*" path="*MyHandler.hndlr" type="MyAssembly.MyAssemblyHandler, MyAssembly" validate="false" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script"/>
</handlers>

解决方案

Are you using IIS7, if so is the application pool running in classic or pipelined mode? If it is IIS7 in pipelined mode then the handler reference needs to go into the following section

<system.webServer>
    <handlers>
    </handlers>
<system.webServer>

rather than in the following section.

<system.web>
    <httpHandlers>
    </httpHandlers>
</system.web>

这篇关于问题映射的HttpHandler - &GT; HTTP错误404未找​​到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆