net core 中跨域设置

 2024-03-02 01:45:05      760    0 

net core 中跨域设置代码如下:

// 设置跨域
services.AddCors(options =>
{
options.AddPolicy("domains_all",
builder =>
{
builder = builder.AllowAnyMethod().AllowAnyHeader().AllowCredentials().WithOrigins(apiSettings.Cors);
});
});