5

So I've been struggling to catch database related errors for example if SQL database is down or unavailable, I've get error thrown by the code and website displays a blank page, and if I use app.UseDeveloperExceptionPage(); in Configure method it works fine, but when I am trying to use

either

 app.UseStatusCodePagesWithRedirects("/error?error={0}");

or

 app.UseExceptionHandler("/error?error={0}");

Nothing happens, just a blank page is displayed, catching other errors such as 404 and so on works just fine. What is a proper way catch all general errors in .NET Core MVC project?

7
  • 1
    perhaps stackoverflow.com/questions/21993758/… can help you out Commented Mar 20, 2017 at 12:43
  • @WoutervanVegchel seems overly complicated for what I need and .Net Core MVC projects are structured and handled differently, so its not really applicable Commented Mar 20, 2017 at 12:57
  • Mabey a more apropriate question would be:"How to handle errors in .net MVC". And i can tell you if you google for a couple of minutes you'll have more answers than you can handle. Commented Mar 20, 2017 at 13:31
  • @SomeRandomName I do not need old and outdates ways to handle errors in .net mvc. Core is a different beasts and handles projects all together different. There are officials tutorials for error handling, but it does not work for connection errors to the database, which Is what I am asking for.. Commented Mar 20, 2017 at 14:35
  • I have run into this same issue, did you manage to find a solution? Commented Oct 13, 2017 at 12:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.