IIS dot net 6 debug error ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app not working edit button Edit

Murugan Andezuthu Dharmaratnam | calendar 31 January 2024 | 60

I was trying to debug an error while developing an application in .net 6. I got this error. but after setting the environment variable to Development still I was not able to view the error details. See the solution below.

An error occurred while processing your request.
Request ID: 00-df68b81cebfbaee3faedaf5f00b134f8-e14e3022ff7ea455-00

Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.

The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.


I restarted iis still It did not work. the solution was to modify the web.config file. please find below the changes to web.config I only added the environmentVariables section

        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      <aspNetCore processPath="dotnet" arguments=".\RigServ.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" >

        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />