George Kosmidis

Microsoft MVP | Speaks of Azure, AI & .NET | Founder of Munich .NET
Building tomorrow @
slalom
slalom

An error occurred while starting the application, Process Failure and many more

by George Kosmidis / Published 4 years and 4 months ago
An error occurred while starting the application, Process Failure and many more

It comes in many colors and flavors, it is usually a headache because there are multiple reasons why you can get this, it usually includes no (or minimal) information in Application log, and if you are unlucky enough to have two problems that cause this, it is a guaranteed bad day.

In this blog post I will try to include as many solutions as possible, please feel free to comment and contribute one if it is not included.

Possible Error Messages

This is just a list the messages you might get, probably not complete. Feel free to comment if I missed some.

  • An error occurred while starting the application
  • 403.14 Forbidden
  • 502.5 Process Failure
  • 500 Internal Server Error
  • 500.0 In-Process Handler Load Failure
  • 500.30 In-Process Startup Failure
  • 500.31 ANCM Failed to Find Native Dependencies
  • 500.32 ANCM Failed to Load dll
  • 500.33 ANCM Request Handler Load Failure
  • 500.34 ANCM Mixed Hosting Models Not Supported
  • 500.35 ANCM Multiple In-Process Applications in same Process
  • 500.36 ANCM Out-Of-Process Handler Load Failure
  • 500.37 ANCM Failed to Start Within Startup Time Limit
  • 500.38 ANCM Application DLL Not Found
  • 503 Service unavailable
  • Failed to start application (ErrorCode ‘0x800700c1’)
  • Connection reset

Possible Solutions

Please keep in mind, most solutions require the application pool to restart. That means, after applying a solution, you need to go to the IIS on the hosting system, find the correct application pool, and restart it. Find out exactly how here.

  1. The app did start, but it can’t generate a valid response.
    Try debugging locally, correct the error and then redeploy.
  2. dotnet is not installed on the hosting system.
    Visit https://dotnet.microsoft.com/download?WT.mc_id=DT-MVP-5004591 and download the latest version. Try the SDK for older OS.
  3. dotnet version is wrong, run dotnet --version in CMD to verify.
    Visit https://dotnet.microsoft.com/download?WT.mc_id=DT-MVP-5004591 and download the latest version. Try the SDK for older OS.
  4. appsettings.[ENVIRONMENT_NAME].json for the specific environment is not deployed.
    Create the necessary appsettings file.
  5. appsettings.json or appsettings.[ENVIRONMENT_NAME].json doesn’t contain all necessary settings.
    Add all settings from the correct appsettings file.
  6. You enabled XML documentation but the XML documentation file path is wrong.
    Right click on your project in Visual Studio, go to Properties, then Build and correct the Documentation XML file path to relative one.
  7. Permissions on the remote machine folders are not set correctly.
    For testing only: try adding Everyone and reset permissions on all child objects. Read this for correct permissions.
  8. The app is deployed to the wrong folder on the hosting system.
    Go to IIS, find your Site and click Explore on the write to find the correct path.
  9. The web.config file is missing from the deployment, or the web.config file contents are malformed.
    Right click on your project in Visual Studio and go to Publish. Execute a publishment and use that web.config.
  10. The web.config contains hostingModel="inprocess" (or it doesn’t).
    Either remove it if it is there, or add it if it is not.
  11. The app is not published for the same processor architecture.
    Check the processor architecture in the hosting system and select the correct one during publishment.
  12. Run the app in a separate IIS application pool.
    Go to the IIS on the hosting machine, navigate to Application Pools, click on Add Application Pool…, write the Name you with and click OK. Once done, go to Sites, find the correct app and click on Basic Settings to select the newly created Application Pool.
  13. Repair the installation of the .NET Core Hosting Bundle or install the SDK.
    Visit https://dotnet.microsoft.com/download?WT.mc_id=DT-MVP-5004591 and download the latest version. Try the SDK for older OS.
  14. Check for CPU/Memory usage spikes on the server during startup.
    Try upgrading the hosting machine.
  15. Disable single-file publishing.
    To do this, set the PublishSingleFile MSBuild property to false.
  16. Switch to the out-of-process hosting model.
    To do this, set the AspNetCoreHostingModel MSBuild property to OutOfProcess.

Enable Logging

The ASP.NET Core Module stdout log often records useful error messages not found in the Application Event Log. To enable and view stdout logs:

  1. Navigate to the site’s deployment folder on the hosting system.
  2. Edit the web.config file. Set stdoutLogEnabled to true and change the stdoutLogFile path to point to the logs folder (for example, .\_logs\stdout). stdout in the path is the log file name prefix. A timestamp, process id, and file extension are added automatically when the log is created.
  3. If the logs folder isn’t present, create the folder.
  4. Ensure your application pool’s identity has write permissions to the logs folder.
  5. Save the updated web.config file.
  6. Make a request to the app.
  7. Navigate to the logs folder. Find and open the most recent stdout log.
  8. Study the log for errors.

Contribute please!

If you find a reason for this error that it’s not included here, please contribute!

This page is open source. Noticed a typo? Or something unclear?
Edit Page Create Issue Discuss
Microsoft MVP - George Kosmidis
Azure Architecture Icons - SVGs, PNGs and draw.io libraries