用ext 6.2.1 建立的classic 项目,在请求webapi遇到了跨域问题html
OPTIONS是正式请求以前发起的预检请求,表示询问来自哪里的请求,是否容许?web
参考:http://www.ruanyifeng.com/blog/2016/04/cors.htmlapi
总之,在后台代码中要设置response head (task.Result 其实就是response)跨域
Access-Control-Allow-Origin :*cors
Access-Control-Allow-Headers : X-Requested-Withui
你的webapi中的action也要支持OPTIONS请求htm
贴上 [System.Web.Http.AcceptVerbs("GET", "POST", "HEAD", "OPTIONS")]blog
这样就OK啦,在OPTIONS请求以后,会从新POST或者GET过去get
其余参考资料it
https://yq.aliyun.com/articles/27800?spm=5176.doc30361.2.3.0apFVd
http://www.cnblogs.com/woodk/p/5578448.html
http://www.tuicool.com/articles/7FVnMz
https://help.aliyun.com/document_detail/31928.html?spm=5176.doc31936.6.618.d9mWPi