From 1baa31db04e01b3ef9c125cc0ab7b768ce19a6a8 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 6 Dec 2023 09:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E6=B3=95=E5=8F=98=E6=9B=B4=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4windows=20=E6=9C=8D=E5=8A=A1=E6=8C=82?= =?UTF-8?q?=E6=8E=89=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/Progranm.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs index ecb3447bd..be89b76e3 100644 --- a/IRaCIS.Core.API/Progranm.cs +++ b/IRaCIS.Core.API/Progranm.cs @@ -27,11 +27,7 @@ using LogDashboard; - -var builder = WebApplication.CreateBuilder(args); - -#region 环境变量设置,以及部署运维平台 - +#region 获取环境变量 //以配置文件为准,否则 从url中取环境值(服务以命令行传递参数启动,配置文件配置了就不需要传递环境参数) var config = new ConfigurationBuilder() .AddEnvironmentVariables() @@ -48,11 +44,19 @@ if (string.IsNullOrWhiteSpace(enviromentName)) : "Development"; } +#endregion + +var builder = WebApplication.CreateBuilder(new WebApplicationOptions +{ + EnvironmentName = enviromentName +}); + +#region 主机配置 NewId.SetProcessIdProvider(new CurrentProcessIdProvider()); -builder.Host.UseEnvironment(enviromentName) +builder.Host .ConfigureAppConfiguration((hostContext, config) => {