Jac*_*ier 8 c# asp.net-core asp.net-core-webapi asp.net-core-configuration
在我的 Azure 中,我有ENVIRONMENT = Development
,但我的设置未加载。
public static IConfiguration Configuration { get; } = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) // reloadOnChange Whether the configuration should be reloaded if the file changes.
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ENVIRONMENT")}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables() // Environment Variables override all other, ** THIS SHOULD ALWAYS BE LAST
.Build();
Run Code Online (Sandbox Code Playgroud)
但它始终使用默认设置。
归档时间: |
|
查看次数: |
9678 次 |
最近记录: |