launchsettings.json中的ASPNETCORE_ENVIRONMENT和运行配置之间有什么区别

时间:2018-01-24 13:54:27

标签: azure .net-core asp.net-core-mvc

ASPNETCORE_ENVIRONMENT

中设置launchsettings.json环境变量之间的区别是什么
{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:55556/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "Departures": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:5001/"
    }
  }
}

并运行配置?

enter image description here

似乎都没有对应用程序实际使用的内容产生影响。

此帖子(Is launchSettings.json used when running ASP.NET 5 apps from the command line on Mac?)表明设置ASPNETCORE_ENVIRONMENT值的正确方法是通过命令行。

问题:

  • 设置ASPNETCORE_ENVIRONMENT值的“正确”方式是什么?
  • 这个值可以在Razor视图(Microsoft.AspNetCore.Hosting.IHostingEnvironment.EnvironmentName)中显示吗?
  • 我可以使用应用刀片的Application settings部分正确设置ASPNETCORE_ENVIRONMENT值吗?

enter image description here

0 个答案:

没有答案