ASP.NET 5未在开发模式下运行 [英] ASP.NET 5 not running in development mode

查看:63
本文介绍了ASP.NET 5未在开发模式下运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将我的ASP.NET 5项目更新为beta 8,现在我们应该使用以下Web命令

I have updated my ASP.NET 5 project to beta 8, and we are now supposed to the following web command

"commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
},

现在我已经用环境变量更新了我的项目.

Now i have updated my project with the environment variables.

这也更新了我的launchSettings.json文件

This has also updated my launchSettings.json file, as so

{
  "profiles": {
    "web": {
      "commandName": "web",
      "environmentVariables": {
        "ASPNET_ENV": "Development"
      }
    }
  }
}

但是由于某种原因,每当我运行命令dnx web时,都会说托管环境是生产环境.为什么不以开发模式启动?

But for some reason, every time I run the command dnx web it says that the hosting environment is Production. Why is it not starting in development mode?

推荐答案

launchSettings.json中的设置仅由VS使用.如果从控制台运行,则必须手动设置该环境变量.

The settings in launchSettings.json are only used by VS. If you run from a console, you have to set that environment variable manually.

CMD:

set ASPNET_ENV=Development
dnx web

PS:

$env:ASPNET_ENV=Development
dnx web

这篇关于ASP.NET 5未在开发模式下运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆