title: IIS 7.5: How to allow a POST request with an extensionless URL and a custom HTTP module? "HTTP 405 Method Not Allowed"
body: <p>I've written a <a href="https://msdn.microsoft.com/en-us/library/ms227673(v=vs.100).aspx#Anchor_1" rel="nofollow">custom HTTP module</a> for a C# ASP.Net app which is deployed to IIS 7.5 running locally. My client sends POST requests to a URL like <code>"http://localhost:9999"</code>. 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 <code>Init()</code> method. However the actual HTTP response being returned to my client has this in its header:</p>
  
  <pre><code>HTTP/1.1 405 Method Not Allowed
  Allow: GET, HEAD, OPTIONS, TRACE
  </code></pre>
  
  <p>Annoyingly I can see the response I expect in the body of the HTTP response, but the header tells the client <code>405 Method Not Allowed</code> and so the client call fails! Does anyone know how to stop this error please?</p>
  
  <p>Here's the relevant part of my app's web.config:</p>
  
  <pre><code>  &lt;system.webServer&gt;
      &lt;handlers&gt;
        &lt;remove name="WebDAV" /&gt;
        &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt;
        &lt;add name="ExtensionlessUrlHandler-Integrated-4.0"
             path="*."
             verb="*"
             type="System.Web.Handlers.TransferRequestHandler"
             preCondition="integratedMode,runtimeVersionv4.0" /&gt;
      &lt;/handlers&gt;
      &lt;modules&gt;
         &lt;remove name="WebDAVModule"/&gt;
         &lt;add name="AuthServiceModule" type="AuthServiceHTTPModule.App_Code.AuthServiceModule"/&gt;       
      &lt;/modules&gt;
    &lt;/system.webServer&gt;
  </code></pre>
  
  <p>where <code>AuthServiceModule</code> is the name of my custom module. I've tried many different options inside the <code>system.webServer</code> 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.</p>