title: Can't PUT to my IHttpHandler, GET works fine
body: <p>I'm in the process of writing an IHttpHandler.  My environment is Windows 7 Enterprise, IIS 7 (it appears).  My handler is running as an application under the default app pool which is running in integrated mode.</p>
  
  <p>Currently my handler's ProcessRequest() method only does the following (just testing at this point):</p>
  
  <pre><code>public void ProcessRequest(HttpContext context)
  {
      context.Response.StatusCode = 200;
      context.Response.ContentType = "text/html";
      context.Response.Output.Write("file uploaded.");
  }
  </code></pre>
  
  <p>I add my handler via the web.config as follows:</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;system.webServer&gt;
          &lt;handlers&gt;
              &lt;add name="HttpUpload" path="*" verb="*" type="HttpUpload, HttpUpload" resourceType="Unspecified"/&gt;
          &lt;/handlers&gt;
      &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I'm using curl to test my handler.  When I do the following:</p>
  
  <pre><code>curl http://localhost/httpupload/foo
  </code></pre>
  
  <p>It works.  However, when I attempt to do a PUT as follows:</p>
  
  <pre><code>curl --upload-file build.txt http://localhost/httpupload/foo
  </code></pre>
  
  <p>It fails with a 405, Method Not Allowed, error.  I searched around and others on stackoverflow indicated that WebDAVModule needs to be removed.  I removed that and it did resolve the 405 error.  However, now I'm getting a 500.21 error.  From the failed request tracing it's saying the 'IIS Web Core' module is generating the 500.21 error because 'The data is invalid.' (8007000d).  The issue seems similar to this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/12069415/iis-7-httphandler-and-http-error-500-21">IIS 7, HttpHandler and HTTP Error 500.21</a></p>
  
  <p>Yet what seemed to fix it for others, eg running aspnet_regiis -i, had no impact for me.  I debugged my handler and it breaks on my handler's ProcessRequest() method when using GET but it doesn't break on it when using PUT thus I know it's not even getting called.  For some reason this other core module is failing the call.</p>
  
  <p>EDIT:</p>
  
  <p>I executed a curl command against the same URL which does a POST and that worked.  So GET and POST work against my http handler, PUT doesn't.  I also executed the same --upload-file curl command to a URL on the same box backed by WebDAV and that worked.</p>
  
  <p>Thanks,
  Nick</p>