Question: How do you troubleshoot IIS Asp.Net Core 3.1 that is running in Production Mode.
Answer: If you want to troubleshoot an Asp.Net Core 3.1 running in IIS, you need to see the errors that the application is emitting by adding a Development environment variable in IIS.
- Open up IIS
- Click on "Configuration Editor"
- Click in the Dropdown menu that says "Section" and choose "System.webServer"
- Find "AspNetCore" and click on it.
- Make sure the "From" Dropdown menu is populated by the "dashboard Web.config"
- In the Main Window, Click to the right of "EnvironmentVariable" on the "three dots"
- Click "Add" to add a Key-Value pair
- In the "Name" textbox type in "ASPNETCORE_ENVIROMENT" and in the "Value" textbox type in "Development"
After you fill in the textbox, close the window and test your application in IIS to see the error.
[Important]: Make sure you reverse the settings to Production Environment Variable when you are done.