天天看點

webapi跨域設定

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

2.在startup.cs中配置

webapi跨域設定
webapi跨域設定

3.然後localhost:3002就可以跨域請求了。如果想所有的網站都可以請求,把allowanyoriginas替換withorigins