Have you seen this error?
An error occurred while starting the application.
.NET Core <version> | Microsoft.AspNetCore.Hosting <version> | Microsoft Windows <version> | Need help?
Besides that one hint, that the error is while starting, it’s not very descriptive, right?
Althouth there many things that could go wrong and the proper way is to actually troubleshoot the error, I end up googling about this for over an hour! In my search I found numerous articles but it turned out that for me the solution was simple!
I forgot to configure the release output path for swagger :/
Probably you already know how to do this, but in case you don’t remember…:
Right click your project, then click
Properties, then click the
Build tab and at the
Output section check the
XML documentation file:
And if configuring swagger wasn’t the solution, you can either check one of the links below, or just troubleshoot your app.
- Microsoft Docs: Common errors reference for Azure App Service and IIS with ASP.NET Core
- Scott Sauber Blog: How to troubleshoot: “An error occurred while starting the application” in ASP.NET Core on IIS
- ASP.NET forums: An error occurred while starting the application. .NET Core X86 v126.96.36.199 | Microsoft.AspNetCore.Hosting version 1.1.1 | Microsoft Windows 6.2.9200RSSHappy to include any other links!
- Blind Coder Blog: asp.net core 2: an error occurred while starting the application