我有一个带有一组自定义环境变量的 Blazor 服务器应用程序,我尝试将环境设置为 web.config 文件上的 DevelopmentLocal,但是它保留在开发环境中
这是
appsettings.json
的列表
程序.cs
...
Console.WriteLine($"This application is running on the environment: {app.Environment.EnvironmentName}");
// Output: This application is running on the environment: Development
// Expected: This application is running on the environment: DevelopmentLocal
...
网络配置
...
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="DevelopmentLocal"/>
</environmentVariables>
...