跨域请求
Posted aimyfly
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了跨域请求相关的知识,希望对你有一定的参考价值。
报错:Access to XMLHttpRequest at ‘http://197.7.50.83:27/WebServices/other/PlaneHandlerJ.ashx‘ from origin ‘http://197.7.50.83:8080‘ has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
修改目标配置文件: Web.config
<customHeaders> <add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET"/> <add name="Access-Control-Allow-Headers" value="Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"/> <add name="Access-Control-Allow-Origin" value="*" /> </customHeaders>
以上是关于跨域请求的主要内容,如果未能解决你的问题,请参考以下文章