在StartUp类里面配置如下代码即可解决跨域问题
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(p => p.AddPolicy("corsapp", builder =>
{
builder.WithOrigins("*").AllowAnyMethod().AllowAnyHeader();
}));
}
在configure类里面添加app.UseCors("corsapp");
标签:CORE,跨域,builder,services,NET,corsapp
From: https://www.cnblogs.com/caozhengze/p/17358352.html