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.
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.
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!
Very interesting your post about this common error that is affecting my deployments to Azure.
Thank you so much for such post.
I have set up my deployments using the pipeline yml file and how can I achieve the same result using the pipeline instead of publishing via Visual Studio?
I read about adding to my pipeline the configuration of removing additional files at destination but I think I’m doing something wrong because it isn’t working.
Looking forward for your help.
Be careful with this if you are running webjobs that are published by separate publish profiles. They will be deleted and will need to be published again after doing this.
I have this same error for my blazor .Net 5 web app running it locally with no usage of Azure services, and it has worked fine during the past weeks of development but just stopped for no reason, and the site is almost done and ready for release.
You could try cleaning the build folder and rebuilding the app. There could be files in there that aren’t supposed to be or aren’t getting overwritten properly when rebuilding the app. This is essentially the issue described in the article for Azure that could be the same reason causing you errors locally.
Thanks! You saved a lot of my nerve cells.