Adding Global Error Handling and Logging in ASP.NET Core

added by DotNetKicks
4/4/2017 12:43:33 PM

1 Kicks, 228 Views

tldr; In ASP.NET Core MVC you can hook up a route to be your global exception handler, and then use the app. Simply add the ExceptionHandler middleware to your Startup.cs Configure method: In your HomeController's Error action, add this code to get at the exception that was raised and do something with it (log...