Why isn’t my IHttpHandler being called?

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

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.)

Here’s the relevant bit of the web.config file:

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

(Obviously there’s other stuff in that section too, but I don’t think it’s relevant.)

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.

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.

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

EDIT: It’s IIS version 6. Attempting to add *.robot to the ISAPI filter now…

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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>

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. Open up IIS admin.
  2. Right click on
    the Web site you want to configure
    and select Properties form the
    context menu. This will display the
    Web Site Properties dialog.
  3. Select
    the Home Directory tab and click the
    Configuration button. This will
    display the Application
    Configuration dialog box.
  4. Click
    Add.
  5. Select the aspnet_isapi.dll
    from the .NET framework directory,
    the extension you want mapped and
    either All Verbs, or just the ones
    you want to map.
  6. Click ok.

Method 2

Jon,

You’ll have to configure the IIS script mappings to pass *.robot to aspnet_isapi.dll.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x