I've written a custom HTTP module for a C# ASP.Net app which is deployed to IIS 7.5 running locally. My client sends POST requests to a URL like "http://localhost:9999"
. I can see my custom module is being executed and is returning the correct response inside the event handler that I registered in my custom module's Init()
method. However the actual HTTP response being returned to my client has this in its header:
HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, OPTIONS, TRACE
Annoyingly I can see the response I expect in the body of the HTTP response, but the header tells the client 405 Method Not Allowed
and so the client call fails! Does anyone know how to stop this error please?
Here's the relevant part of my app's web.config:
<system.webServer>
<handlers>
<remove name="WebDAV" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0"
path="*."
verb="*"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<modules>
<remove name="WebDAVModule"/>
<add name="AuthServiceModule" type="AuthServiceHTTPModule.App_Code.AuthServiceModule"/>
</modules>
</system.webServer>
where AuthServiceModule
is the name of my custom module. I've tried many different options inside the system.webServer
element but none seem to allow the POST request through. I'd rather have a solution that involves config within the app rather than IIS itself, please.