web.app 里面设置:
<configuration>
<system.webServer>
<httpProtocol>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" />
</httpProtocol>
</system.webServer>
</configuration>
指定能访问api的网站的域名:
<configuration>
<system.webServer>
<httpProtocol>
<add name="Access-Control-Allow-Origin" value="http://localhost:52411" />
<add name="Access-Control-Allow-Origin" value="https://www.csdn.net/" />
<add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" />
</httpProtocol>
</system.webServer>
</configuration>