Asp.net core 在“中运行ASP.NET核心应用程序”;“发展”;环境

Asp.net core 在“中运行ASP.NET核心应用程序”;“发展”;环境,asp.net-core,project.json,.net-core-rc2,Asp.net Core,Project.json,.net Core Rc2,我使用的是ASP.NET Core RC2,当我运行dotnet run时,我的应用程序总是在“生产”模式下运行。我无法将其改为“发展” 我有以下launchSettings.json文件: { "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhos

我使用的是ASP.NET Core RC2,当我运行
dotnet run
时,我的应用程序总是在“生产”模式下运行。我无法将其改为“发展”

我有以下
launchSettings.json
文件:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:26088/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "MVCCoreRc2App": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}
当我设置
“ASPNETCORE\u环境”:“开发”
时,我不知道为什么
dotnet
正在“生产”中运行应用程序


这是在ASP.NET核心RC1中运行的。我缺少什么?

launchsettings.json在从Visual Studio启动时使用,但不是从命令行dotnet.exe启动

在控制台上,在调用
dotnet run
之前设置环境变量


set ASPNETCORE\u ENVIRONMENT=Development

如果您使用的是Bash,那么相应的行是:

export ASPNETCORE_ENVIRONMENT=Development

您可以在
~/.bashrc
文件中设置此选项,使其在您登录时应用。

您甚至可以在以下位置运行应用程序时在命令行中更改环境:

dotnet run environment=development

对我来说,这似乎不是一个永久的解决办法。每次我需要设置这个变量。我正在用IIS托管什么应用程序?@Vipul,在你的电脑上而不是在命令行上设置此变量。