diff --git a/LFlow.Base/Program.cs b/LFlow.Base/Program.cs index 420bb2a..5cad4bc 100644 --- a/LFlow.Base/Program.cs +++ b/LFlow.Base/Program.cs @@ -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 builder.Host.UseSerilog((context, services, config) => { @@ -86,6 +97,7 @@ public static class Program Log.Logger.Information("ApplicationStarted"); CodeFirst.InitTable(); }); + app.UseCors("AllowAny"); app.Run(); }