Question: How do you troubleshoot IIS Asp.Net Core 3.1 that is running in Production Mode.
- 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.
Errors: If you find that you can't Edit the Environment Variables in the IIS to change to Production or Development follow the solution below:
Step 1: Open notepad as an Administrator
Step 2. Copy and paste %windir%\system32\inetsrv\config path into Notepad
Step 3: Change from *.txt to all Files to be able to see the config file and edite it.
Step 4: Edit applicationHost.config file
Step 5: Press (Ctr + F) to search in applicationHost.config file for ASPNET
Step 6: Change from true to false next to Lock-Section