一般情况WebApi都是跨域请求,没有设置跨域一般会报以下错误 No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:48057' is therefore not allowed access. ASP.net Core 跨域有两种,全局和区域 全局跨域: 打开Startup.cs文件.在ConfigureServices方法中添加以下代码 1