preflight request (OPTIONS) WebAPI 時,會回 405 Method Not Allowed ?

最近同事詢問他將程式中 enable cors 的程式碼(WebApiConfig.cs's Register method)  mark 掉,

config.EnableCors(new EnableCorsAttribute("*", "*", "*"));

然後在 web.config 的 customHeaders 加入允許 cors 的設定

但是 client js 在做 preflight request 時,卻會回 405 Method Not Allowed 

...繼續閱讀 »