How to set web.config file to show full error message (.net core 2.1)
web.config
<system.webServer>
<httpErrors errorMode="Detailed" />
<aspNetCore processPath="dotnet">
<environmentVariables>
<environmentVariable name="ASPNETCORE_DETAILEDERRORS" value="true" />
</environmentVariables>
</aspNetCore>
</system.webServer>
You can configure it in your Startup.cs
file. By default, it shows the Developer Exception Page only in development mode:
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
If you replace this part just with app.UseDeveloperExceptionPage();
it will always show the detailed error message.
You can read more about it here: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/error-handling?view=aspnetcore-2.1
For me, enabling ASPNETCORE_DETAILEDERRORS didn't do anything, but changing ASPNETCORE_ENVIRONMENT worked:
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
More info: https://docs.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-3.1#enable-the-developer-exception-page