在网站部署的时候会生成config文件,在里面加入即可
<!--CORS策略阻止 跨域访问问题-->
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="Access-Control-Allow-Origin" value="*" />--*号代表全部,也可以单独给域名
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
在你的IIS项目里都会生成一个web.config文件,只需将上面代码放入即可解决
是在<configuration>下面的
已被CORS策略阻止:请求的资源上不存在‘Access Control Allow Origin---加入config内容
于 2021-08-09 15:22:12 首次发布