ASP.Net Core app works in visual studio but not with dotnet run

后端 未结 1 1727
慢半拍i
慢半拍i 2021-01-07 02:09

I have a asp.net core app that I started building through visual studio and normally it works fine when I press F5 or press the debug button in visual studio.

Howeve

相关标签:
1条回答
  • 2021-01-07 02:25

    Error occurred because value of ASPNETCORE_ENVIRONMENT variable is different. In case of Visual Studio it was set to Development and in case of dotnet cli (as you can see in screenshot in question), it was Production.

    To set ASPNETCORE_ENVIRONMENT variable using command line, use below command -

    setx ASPNETCORE_ENVIRONMENT "Development"
    

    For more information on how to set hosting environment, please refer this article.

    0 讨论(0)
提交回复
热议问题