在 Startup 里加:
services.AddCors(options => options.AddPolicy(
DefaultCors,
p => p.SetIsOriginAllowedToAllowWildcardSubdomains()
.WithOrigins("https://*.cnblogs.com", "http://*.cnblogs.com","https://localhost:44316")
.AllowAnyMethod().AllowAnyHeader()));
}
再在
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseCors(DefaultCors);
。。。
}