HTTP Error 500.30 - ASP.NET Core app failed to start

You may get this kind of error when your ASP.NET Core application fails to start.

HTTP Error 500.30 - ASP.NET Core app failed to start

Common solutions to this issue:

  • The app failed to start
  • The app started but then stopped
  • The app started but threw an exception during startup

Troubleshooting steps:

  • Check the system event log for error messages
  • Enable logging the application process' stdout messages
  • Attach a debugger to the application process and inspect

 

 The error page gives three solutions in the troubleshooting steps. If you don't have access to the server, you can’t check the details of the error using event logs or by attaching a debugger to the application process.  You will have to opt for the second option that is “Enable logging the application process' stdout messages.” This can be done using the following steps.

 Open your web.config file

Inside the <system.webServer> tag add the following line if it is not already there. If it is already there, just make sure that "stdoutLogEnabled" is set to true. 

 <aspNetCore processPath="dotnet" arguments=".\yourapplication.dll" 
stdoutLogEnabled="true" stdoutLogFile=".\logs\stdoutlog" hostingModel="inprocess" />

“Yourapplication.dll” Should be replaced with the assembly name of your application. Path to the log file also can be replaced with a path you prefer. When you run the application after making these changes, you will get details of the error in the log file. 

You can configure it the following way if you need enhanced diagnostic logs.

<aspNetCore processPath="dotnet" arguments=".\ExperimentProject.dll" 
  stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
        <handlerSettings>
          <handlerSetting name="debugFile" value=".\logs\EnhancedAspnet-debug.log" />
          <handlerSetting name="debugLevel" value="FILE,TRACE" />
        </handlerSettings>
      </aspNetCore>

Here, <handlerSettings> is added to the <aspNetCore> element in web.config

The application pool (using IIS AppPool\{APP POOL NAME}) requires Write access to the place where the logs are written. When the log file is created, any folders in the path (logs in the previous example) are created by the module.

Debug level (debugLevel) values may include both the location and the level. For the logging level, you can give one of the following values (in order from least to most verbose)

  • ERROR
  • WARNING
  • INFO
  • TRACE

You can give one or more than one location (multiple location values can be comma separated). The following are the valid locations.

  • FILE
  • EVENTLOG
  • CONSOLE

Do not leave the debug logging available in the deployment for longer than necessary. The size of the log is not limited. By leaving the debug log enabled, the available disk space can be exhausted and the server or app service can crash.


Search