Blazor 服务器:无法更改 ASPNETCORE_ENVIRONMENT

问题描述 投票:0回答:1

我有一个带有一组自定义环境变量的 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>
...
asp.net-core blazor blazor-server-side
1个回答
0
投票

检查您的 launchSettings.json 文件。

© www.soinside.com 2019 - 2024. All rights reserved.