asp.net mvc 跨域配置

时间:2021-11-27 16:02:26

修改 web.config 文件

<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
<add name="Access-Control-Allow-Methods" value="*" />
<add name="Access-Control-Max-Age" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>