1. 添加中间件
在 ConfigureServices 中添加
// 跨域中间件服务 services.AddCors();
在 Configure 中添加
// 跨域配置 App.UseCors(builder => builder.WithOrigins("http://example.com").AllowAnyHeader());
来源: http://www.bubuko.com/infodetail-2855547.html