How to Debug Asp.Net Core 3.1 in IIS Development Environment Variable

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.

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


Edit this Article
Debug Asp.Net Core 3.1 in IIS Technology published
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

Your Session is Ending
Login to Continue

© 2021 - ErnesTech - Privacy