天天看点

webapi跨域设置

1.安装Microsoft.AspNetCore.Mvc.Cors;

2.在startup.cs中配置

webapi跨域设置
webapi跨域设置

3.然后localhost:3002就可以跨域请求了。如果想所有的网站都可以请求,把allowanyoriginas替换withorigins