I would suggest two solutions:
1) If you use WebAPI, you need to implement an options method, which by convention should look like this:
public class XXXController : ApiController {
2) If you are not using WebAPI, try to figure out which part of the code is causing the OPTIONS 405 (Method Not Allowed) error to call OPTION. In this case, I would check if I try to add these <customHeaders/> Web.config file that work:
<configuration> <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> <add name="Access-Control-Allow-Headers" value="Content-Type, Authorization, Accept, X-Requested-With" /> <add name="Access-Control-Allow-Methods" value="OPTIONS, TRACE, GET, HEAD, POST, PUT" /> </customHeaders> </httpProtocol> </system.webServer> </configuration>
Filippo vitale
source share