ASP.NET Core: Display more detailed information about the error after publishing project on Azure

Standard

After deploying ASP.NET CORE project on Azure, I start getting bunch of 500 internal errors for webapi’s, I investigated the failures in chrome dev tool and couldn’t find any detailed information there.

screenshot_4

The html response from server was:

screenshot_3

Solution:

So in-order to check out actual exception, I added couple of line in web.config file of project

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
      <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
      </environmentVariables>
    </aspNetCore>

Yo can also add ASPNETCORE_ENVIRONMENT variable as App settings in Application Settings section of WebApp in Azure Portal.

screenshot_5