The requested resource does not support http method ‘OPTIONS’

This error is closely related CORS.  You are probably getting this error with HTTP 405 errors, maybe using a Chrome or Firefox browser.  You may be doing an ajax POST.

If you are using ASP.NET WebAPI 2, you can enable CORS.

http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api#enable-cors

This article is for ASP.NET WebApi.  Many online solutions states that you need to add customHeaders.

<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, HEAD" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
</customHeaders>
</httpProtocol>
</system.webServer>

Now, if you use attribute routing in your project, you should create a method like the following:

[Route("api/XXXXApp/XXXXEntity")]
[HttpOptions]
public HttpResponseMessage Options()
{
var resp = new HttpResponseMessage(HttpStatusCode.OK);
return resp;
}

Note: make sure “<remove name=”OPTIONSVerbHandler” />” is in your web.config.  Disable WebDAV if you have it.

Special thanks to this article that finally solves it for me.

References:

http://stackoverflow.com/questions/19095777/how-to-support-http-options-verb-in-asp-net-mvc-webapi-application