受欢迎的博客标签

various Exception-handling in an ASP.NET Core 3.x

Published

There are two types of startup errors.
Unhandled exceptions are originating outside of the Startup class, and exemptions from inside of Startup.

These two errors can behave differently and may need different troubleshooting methods.

ASP.NET Core will solve exceptions from inside the Startup class.

 

A developer exception page
Custom error pages
Static status code pages
Startup exception handling

Startup exception handling

How to log startup error messages in ASP.NET Core 3.x

1.An error occurred while starting the application.

Some things that might have gone wrong:

You might not have the correct .NET Core version installed on the server.

You might be missing DLL’s Something went wrong in your Program.cs or Startup.cs before any exception handling kicked in  

you might immediately go to the Operation System Event Viewer to see what happened .

 just add

.CaptureStartupErrors(true) to WebHostBuilder :

 https://docs.microsoft.com/en-us/aspnet/core/fundamentals/hosting#configuring-a-host.