1

My web.config is setup as following. My handler lives in an assembly called TestProject.Custom. I am calling this handler via jQuery post, works great in VS 2010 (of course!) but when I push it out to IIS 7.5 or IIS 7, it throws 404 about not being able to find TestHandler.ashx. Not sure what I am missing.

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />

<handlers>
  <add name="TestHandler"
       verb="*" preCondition="integratedMode"
       path="TestProject.Custom.HttpHandlers.TestHandler.ashx"
       type="TestProject.Custom.HttpHandlers.TestHandler, TestProject.Custom"/>

</handlers>

Edit: I am calling this handler with jQuery and the handler is behind forms authentication (which I don't think is the problem):

jQuery(function () {
    jQuery.ajax({
        type: "POST",
        url: "TestHandler.ashx",
        data: { "test_data": "some test data" }
    });
});
codelove
  • 1,396
  • 3
  • 17
  • 35

2 Answers2

1

I think the "path" attribute should be "TestHandler.ashx" instead of its current value. It must match the URL you use in jQuery. Otherwise, 404 is expected.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
0

404 usually means a problem with the registration, basically it just can't find something to handle the request that came in.

Inside of the add node, try adding the following attribute at the end: resourceType="Unspecified"

That tells IIS not to look for a physical file when it sees the request for the ashx. I think that's causing the 404

swannee
  • 3,346
  • 2
  • 24
  • 40
  • Unspecified is the default value, so you can safely omit that attribute, http://www.iis.net/ConfigReference/system.webServer/handlers/add – Lex Li Feb 24 '12 at 05:37