Learning While Aging

Fix ASP.NET Core application HTTP Error 500.30 ANCM In-Process Start Failure

Last week when I was working on an ASP.NET Core web application, suddenly I got an error like this:

HTTP Error 500.30 - ANCM In-Process Start Failure
Common causes of 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

The common causes listed in the error message are quite vague and not very helpful. But fortunately, the link in the error message above to Microsoft’s documentation site provides some guidance on how to fix the error.

I have to admit that the troubleshooting information in the error message or on Microsoft documentation site does not provide enough details on how to fix the error, but they both mention one thing that is very helpful: check the Event Log.

So I launched the Event Viewer and saw two errors with the same source: IIS AspNetCore Module V2, and one of the errors gave me some clue about the error.

The highlighted error message in the screenshot above shows that when using Dependency Injection to register authentication service, an exception was thrown. Since the error says “Scheme already exists: Identity.Application…”, it gave me a clue that the application was trying to register Identity service more than once. So I checked the Startup.cs where services are registered, surely enough, I saw two duplicated lines of code like this:

           services.AddIdentity<User, IdentityRole>().AddEntityFrameworkStores<AppDbContext>();

           services.AddIdentity<User, IdentityRole>().AddEntityFrameworkStores<AppDbContext>();

After I deleting the duplicate line of the code, the error went away.

Hope this helps.

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x
Close Bitnami banner