We all know that in production environments we shouldn’t use the “right-click publish” feature within Visual Studio. However, there are plenty of development scenarios where this feature is necessary, and publishing to an Azure App Service Web App directly from Visual Studio is required. Unfortunately, there are times when doing this will result in the Azure App Service Web App to return a response with an HTTP 500.30 error when attempting to run a .NET Core web application that has been published.

HTTP Error 500.30 - ANCM In-Process Start Failure
Common solutions to this issue:
- The application failed to start
- The application started but then stopped
- The application 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
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265

Why the Error?

This error can be somewhat confusing when you encounter it. This is especially true when you have a newly created Azure App Service Web App and are publishing your code to it from Visual Studio for the first time, or even when you have had your web app code run successfully in previous publishes. This is a somewhat common error that can occur form a Visual Studio Publish.

The “HTTP Error 500.30 – ANCM In-Process Start Failure” error most often occurs when the .NET Core web application fails to start up. This means that the troubleshooting step suggestion the error message gives you will not work. If the application can not start up, then you can not attach a debugger to it. This can be very perplexing of an error if you’ve never encountered it before, and hopefully the below tip will help save you TONS of troubleshooting time!

Also, when you check the Application Event Logs, you may see some additional information that indicates this same error has occurred.

Application '/LM/W3SVC/870738454/ROOT' with physical root 'D:\home\site\wwwroot' failed to load coreclr. Exception message:
CLR worker thread exited prematurely
Process Id: 19728.
File Version: 13.0.19309.1. Description: IIS ASP.NET Core Module V2 Request Handler.
Commit: 22dedcb

Now, that’s get to fixing the error!

Let’s Fix It

The most common and easiest way to resolve this error is to re-publish your code, but with the options to “Remove additional files at destination” turned on. This will ensure that Visual Studio’s web deploy process will delete all existing files from the Web App before copying over the new code files. This will result in only the necessary files being published will exist in the Web App file system after the publish has completed. It also ensures that all files are overwritten with the newest versions; in case that may be interfering somehow as well.

To enable the Remove additional files at destination setting, click Edit on the Publish Profile within Visual Studio.

Fix .NET Core HTTP Error 500.30 After Publish to App Service from Visual Studio 1
Visual Studio Publish Profile displayed with the Edit link highlighted

The setting is located on the Settings tab underneath the File Publish Options expandable area. Check the box to enable the feature, then click Save.

Fix .NET Core HTTP Error 500.30 After Publish to App Service from Visual Studio 2
Visual Studio Publish profile settings with “Remove additional files at destination” setting turned on and highlighted

Wrap Up

Once you make this change to the Visual Studio Publish Profile to remove additional files at destination when publishing to the Azure App Service Web App, then the web application should start up without error after the next publish. If this doesn’t work to fix the error, then it’s being caused by something else. However, this is probably the most common reason this error occurs, so give this solution a try first and hopefully save yourself a ton of unnecessary headache!

Happy coding!

Microsoft MVP

Chris Pietschmann is a Microsoft MVP, HashiCorp Ambassador, and Microsoft Certified Trainer (MCT) with 20+ years of experience designing and building Cloud & Enterprise systems. He has worked with companies of all sizes from startups to large enterprises. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.
HashiCorp Ambassador Microsoft Certified Trainer (MCT) Microsoft Certified: Azure Solutions Architect