title: 405 method options not allowed in asp.net web api controller?
body: <p>I have this very common issue where it says method not allowed (<code>OPTIONS</code>) for a <code>GET</code> request. I am getting the following error whenever I make an API call. I have this setting in <code>web.config</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;system.webServer&gt;
    &lt;modules&gt;
      &lt;remove name="WebDAVModule"/&gt;
    &lt;/modules&gt;
    &lt;httpProtocol&gt;
      &lt;customHeaders&gt;
        &lt;add name="Access-Control-Allow-Origin" value="*"/&gt;
        &lt;add name="Access-Control-Allow-Headers" value="Origin, Authorization, X-Requested-With, Content-Type, Accept"/&gt;
        &lt;add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS"/&gt;
      &lt;/customHeaders&gt;
    &lt;/httpProtocol&gt;
    &lt;handlers&gt;
      &lt;remove name="WebDAV"/&gt;
      &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0"/&gt;
      &lt;remove name="OPTIONSVerbHandler"/&gt;
      &lt;remove name="TRACEVerbHandler"/&gt;
      &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/&gt;
    &lt;/handlers&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>I tried using <code>Asp.Net.WebApi.Cors</code> and enforcing CORS globally using <code>EnableCors()</code> for all origin headers and methods and that did not work either.</p>