配置跨域策略
This commit is contained in:
parent
47db444117
commit
f171251921
|
|
@ -53,6 +53,17 @@ public static class Program
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
// 配置跨域策略
|
||||||
|
builder.Services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddPolicy("AllowAny", builder =>
|
||||||
|
{
|
||||||
|
builder.AllowAnyOrigin()
|
||||||
|
.AllowAnyMethod()
|
||||||
|
.AllowAnyHeader();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// 使用Serilog,此处为了修复 `The logger is already frozen` 的问题,重新配置Serilog
|
// 使用Serilog,此处为了修复 `The logger is already frozen` 的问题,重新配置Serilog
|
||||||
builder.Host.UseSerilog((context, services, config) =>
|
builder.Host.UseSerilog((context, services, config) =>
|
||||||
{
|
{
|
||||||
|
|
@ -86,6 +97,7 @@ public static class Program
|
||||||
Log.Logger.Information("ApplicationStarted");
|
Log.Logger.Information("ApplicationStarted");
|
||||||
CodeFirst.InitTable();
|
CodeFirst.InitTable();
|
||||||
});
|
});
|
||||||
|
app.UseCors("AllowAny");
|
||||||
app.Run();
|
app.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue