为什么我的IHttpHandler被称为? [英] Why isn't my IHttpHandler being called?

查看:143
本文介绍了为什么我的IHttpHandler被称为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让一个自定义的处理程序,以对特定URL的工作(或一组网址)的ASP.NET 3.5。

I'm trying to get a custom handler to work for a specific URL (or set of URLs) in ASP.NET 3.5.

该处理程序实际上并没有做任何显著的是 - 它只是记录的请求。我可以张贴code,如果任何人的东西是相关的,但我真的不认为它被称为可言。 (特别是,对于正常的例外,我得到一个自定义错误页和记录......在这里我只是得到香草IIS 404)。

The handler doesn't actually do anything significant yet - it just logs the request. I can post the code if anyone things it's relevant, but I really don't think it's being called at all. (In particular, for normal exceptions I get a custom error page and logging... here I'm just getting the vanilla IIS 404.)

这里的 web.config中的相关位文件:

<system.web>
  <httpHandlers>
    <add verb="GET,POST" path="*.robot" validate="false" 
         type="CSharpInDepth.Wave.RobotHandler, CSharpInDepth"/>
  </httpHandlers>
</system.web>

(显然有在该节其他的东西太多,但我不的认为的是相关的。)

在当地,开发服务器下运行,它工作正常。在我的实际中,我总是得到网站目录本身下404一切都是相同的(通过SVN复制)。这包括包含目录 CSharpInDepth.dll ,我已经验证包含 CSharpInDepth。 Wave.RobotHandler

Locally, running under the dev server, it works fine. On my real box, I always get a 404. Everything under the web site directory itself is the same (replicated via svn). That includes the bin directory containing CSharpInDepth.dll, which I've verified contains CSharpInDepth.Wave.RobotHandler.

我尝试获取 http://csharpindepth.com/foo.robot 并只得到404

I try to fetch http://csharpindepth.com/foo.robot and just get a 404.

我试过与无集名称,具体网址或通配符的...没什么的工作。

I've tried with and without the assembly name, specific URLs or wildcarded ones... nothing's working.

我敢肯定,我只是错过了一些简单的标志某处IIS配置,但我炸飞,如果我能找到它...

I'm sure I've just missed some simple flag somewhere in the IIS configuration, but I'm blowed if I can find it...

编辑:这是IIS版本6.尝试* .robot添加到ISAPI筛选器现在......

It's IIS version 6. Attempting to add *.robot to the ISAPI filter now...

推荐答案

好吧,如果托管框IIS7在综合管线你需要将它添加到配置的其他位:

Well if the hosting box is IIS7 in integrated pipeline you need to add it into the other bit of the config:

<system.webmodules>
  ....
  <modules>
    <add name="RobotHandler" type="CSharpInDepth.Wave.RobotHandler, CSharpInDepth"/>
  </modules>
  ....
</system.webmodules>

如果是IIS6那么你就需要为* .robots映射到ASP.NET ISAPI DLL。

If it's IIS6 then you'll need to map *.robots to the ASP.NET ISAPI DLL.

(对于非长柄水杓你做到这一点,如下所示)

(For the non-Skeets you do this as follows)


  1. 打开了IIS管理。

  2. 右键点击
    要配置网站
    并选择属性形成
    上下文菜单。这将显示
    Web站点属性对话框。

  3. 选择
    主目录选项卡并单击
    配置按钮。这会
    显示的应用
    配置对话框。

  4. 点击
    加。

  5. 选择ASPNET_ISAPI.DLL
    从.NET框架的目录,
    你想映射的延伸和
    要么所有动词,或者只是那些
    要映射。

  6. 单击确定。

这篇关于为什么我的IHttpHandler被称为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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