[Solved] An error occurred while processing your request…enable the Development environment by setting …

When a web project is deployed to the local machine, an exception occurs when accessing:

Error.
An error occurred while processing your request.
Request ID: |ee4a30bd-4030df869db691a6.

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.

 

Reason for the error:

The project itself uses the .netcore 3.1 framework, published to the IIS web.config, missing the ASPNETCORE_ENVIRONMENT configuration.

This error is displayed, meaning that the project itself reported an error, IIS thinks you can set the development version (Development) to see more detailed exception information, but you do not configure ASPNETCORE_ENVIRONMENT, so you can not think that this is the development version, you need to add, in order to show you the specific cause of the exception. So the configuration needs to be added.

Solution:
In the <aspNetCore> node of IIS web.config, add the ASPNETCORE_ENVIRONMENT configuration as follows.

<aspNetCore processPath="dotnet" arguments=".\IndustryWeb.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" >
  <environmentVariables>
    <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
  </environmentVariables>
</aspNetCore>

Read More: