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: https://gist.github.com/scottsauber/e6889b60ec69eba1e7bb9c04ff32a438 In your HomeController's Error action, add this code to get at the exception that was raised and do something with it (log...


0 comments