We can use the web deploy function of visual studio to publish our application to the production environment. Sometimes, you may receive the below error after publishing your application.
HTTP 500.30 - ANCM In-Process Start Failure
You will receive this error when a .Net core application fails to start. Here, you can't attach a debugger until the application starts. It means you can't get suggestions for troubleshooting. If you haven't face the same issue before, it can be a puzzle of an error for you.
If you can check for the event log, You will see the below information for the same error.
Application '/LM/W3SVC/870738454/ROOT' with physical root 'C:\Inetpub\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
How to fix it?
You need to re-publish your code from Visual Studio to fix this issue quickly. Here, you need to enable remove additional files at destination. This feature will ensure that web-deploy will remove the files from the destination before re-publish the new code. So all the files are overwritten with the newest versions.
Here, we have mentioned how you can enable Remove additional files at destination settings in visual studio web deploy.
Inside Visual studio at the publish profile, click on the Edit button.
It will open the publishing settings. Inside file publish option, tick on the remove files at the destination.
After making these changes, your application should start working after publishing.