Why is AspNet 6 Application always running in Production Mode

Question: I just upgraded Asp.Net 5 Application to Asp.Net 6, when I run the command 
dotnet watch run

The application always starts in the Production Mode, why is that?

Login to See the Rest of the Answer

Answer: You should be able to run the Asp.Net 6 in Development mode by typing the following command.
dotnet watch run --ASPNETCORE_ENVIRONMENT=Development

The command above should start the Application in the Development Mode and be able to debug from there.

- I hope this helps you.

CodeFolk said:

Hello, the reason why Asp.Net 6 is always running in production mode even when you are debugging is that you have other class libraries compiled in release mode. This lets the dotnet run think that you want to run in Production mode. The way you resolve this issue is by making those Class Libraries compile in debug mode or don't check any CheckBoxes for Optimize for Release or Debug at all.

Posted On: March 13, 2022 13:24:49 PM

© 2024 - ErnesTech - Privacy
E-Commerce Return Policy