xmlhttprequest cannot load response URL. for preflight has invalid http status code 405 for $http.delete
<p>I have web API service:</p>

<pre><code>public void Delete(int id)
        {
}
</code></pre>

<p>Web api-Web.config </p>

<pre><code>&lt;httpProtocol&gt;
      &lt;customHeaders&gt;
        &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;
        &lt;add name="Access-Control-Allow-Headers" value="Content-Type" /&gt;
        &lt;add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" /&gt;
      &lt;/customHeaders&gt;
    &lt;/httpProtocol&gt;
    &lt;validation validateIntegratedModeConfiguration="false" /&gt;
    &lt;directoryBrowse enabled="true" /&gt;
    &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
    &lt;handlers&gt;
      &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /&gt;
      &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /&gt;
      &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt;
      &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /&gt;
      &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /&gt;
      &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt;
    &lt;/handlers&gt;
</code></pre>

<p>when I use it using Postman (Chrome extension). I am passing data as 'form data'. And I get 200 return code.
I have call this method using angularjs:</p>

<pre><code>deletesurvey: function(surveyData) {
                var objFormData = new FormData();
                for (var key in surveyData)
                    objFormData.append(key, surveyData[key]);
                return $http.delete(configurationurl + 'Survey', objFormData, {
                    transformRequest: angular.identity,
                    headers: { 'Content-Type': undefined }
                });
</code></pre>

<p>i have set headers in my Web.Config:</p>

<pre><code>&lt;modules runAllManagedModulesForAllRequests="true" /&gt;
    &lt;httpProtocol&gt;
      &lt;customHeaders&gt;
        &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;
        &lt;add name="Access-Control-Allow-Methods" value="GET,POST,PUT,HEAD,DELETE,OPTIONS" /&gt;
        &lt;add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" /&gt;
        &lt;add name="Access-Control-Request-Methods" value="*" /&gt;
        &lt;add name="Access-Control-Max-Age" value="1728000" /&gt;

      &lt;/customHeaders&gt;
    &lt;/httpProtocol&gt;
</code></pre>

<p>after it call deletesurvey function it is giving me error (Browser is Chrome)
<strong>xmlhttprequest cannot load response URL for preflight has invalid http status code 405</strong></p>