Azure WebApp Asp.NET Core 2 error: An error occurred while starting the application

Arvind Sisara picture Arvind Sisara · Nov 6, 2017 · Viewed 33.4k times · Source

I have upgraded asp.net core 1.1 to an asp.net core 2. It runs fine on the local server, but when I try to deploy it to an Azure hosted web app, I received the error:

An error occurred while starting the application. .NET Core

4.6.00001.0 X86 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 2.0.0-rtm-26452 | Microsoft Windows 6.2.9200

enter image description here

Any ideas?

Answer

Suneet Nangia picture Suneet Nangia · Nov 6, 2017

Please add ASPNETCORE_DETAILEDERRORS = true in app settings of your app, restart it and see the detailed error next time you load the url. That will help you fix it.

For example, error in my case was that I didn't have the managed identity of my API App configured to access the Key Vault to get the storage account and Cosmos DB keys. I used startup to inject the configured storage and cosmos db objects hence it was failing the moment I was starting my app.