Reputation: 1386
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" }
});
});
Upvotes: 1
Views: 1867
Reputation: 63296
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.
Upvotes: 1
Reputation: 3466
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
Upvotes: 0