Identify ASP.Net Core startup errors

Maybe you know this great and informative error message "An error occurred while starting the application." from asp.net core when there was an exception during the startup.

To identify and understand what happened, you must extend the Main method with the following things:

  • UseSetting("detailedErrors", "true")
  • CaptureStartupErrors(true)

After this is done, you will see a nice and detailed error page like this:

In my case the startup error was a missing json file which the application tried to load on startup.


Posted Nov 30 2016, 04:31 PM by Holger Vetter
Filed under: ,

Comments

Jim wrote re: Identify ASP.Net Core startup errors
on 01-24-2017 23:18

Oh man.  Thank you for posting this.  Saved my bacon.

Alcides Soares wrote re: Identify ASP.Net Core startup errors
on 02-16-2017 23:58

Great tip! Save my day!!!!

Dan wrote re: Identify ASP.Net Core startup errors
on 04-17-2017 8:11

Thank you so much for this! Wasted the past few hours trying to find out what was wrong before stumbling across this post!

JR wrote re: Identify ASP.Net Core startup errors
on 04-20-2017 13:27

Thanks! Really Helpful!

basti wrote re: Identify ASP.Net Core startup errors
on 04-20-2017 18:28

thank you so mutch man!

Steve wrote re: Identify ASP.Net Core startup errors
on 04-28-2017 1:29

Bacon saved here too - thanks Holger!

Diego wrote re: Identify ASP.Net Core startup errors
on 05-08-2017 15:17

You saved my day too. Thank you!

Kyle wrote re: Identify ASP.Net Core startup errors
on 05-25-2017 12:02

Thanks for sharing this! Saved me a lot of time - my error was a SQL connection string with the wrong name, which I would have spent ages to find if it wasn't for this. Very helpful.

Johann wrote re: Identify ASP.Net Core startup errors
on 05-29-2017 11:15

Have a hug! I was trying everything I could think of and/or found via google, and nothing brought me closer to a solution. Found this post and consequently—within the minute—my error. Phew!

developers.de is a .Net Community Blog powered by daenet GmbH.