ANCM InProcess Start Failure Shenanigans


Common issue with .net core solutions when you deploy to a server and get ANCM In-Process failures

- January 30, 2020

Rest of the Story:

If you are using .NET Core and have not received the following error/exception message I will send you $1.00.  Let me know! 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

I have ran into this plenty of times already.  There are many reasons but at it’s root dotnet is not able to start up for one of many reasons.  As I run into my issues I will update this post with them. So far, with ASP.NET Core 3.1.1 1. The IIS Application Pool – Advanced Settings “Enable 32-Bit Applications” – setting to False fixed my issue (this site was deployed to an on-premise IIS Server) 2. Azure installation – It was more difficult to identify the source of the issue as I was not working directly with IIS (Internet Information Server).  I first tried logging via App Service Logs,  and view the streaming logs which led me to error message similar to..

”IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.</li>     <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.”
I then worked towards running the web application from command line to hope it gave me more information. i.e. Diagnostic Console – Debug Console then running the web assembly via “dotnet web.dll” (in this case my application was called Web). 

This gave me a much better startup.cs issue. I had good sense to recognize the issue/exception was within my startup class.  I had my first real clue from the following message…

”Unhandled exception. System.IO.DirectoryNotFoundException: D:\home\site\wwwroot\Scripts\ at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters) at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root) at Web.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, LinkGenerator lin”

image

I had used in prior 2.1 Core solution a scripts static directly which did not exist with this 3.1 solution.

app.UseStaticFiles(new StaticFileOptions   {    
FileProvider = new PhysicalFileProvider
(Path.Combine(Directory.GetCurrentDirectory(), "Scripts")),
RequestPath = "/Scripts" });

Once I removed this reference to /Scripts things worked and I was up and running. 

So, just note that this ANCM error is pretty good indication that something is wrong with Startup.cs class and so you really will be looking for logs for some indication as to what.

image