Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display errors with ASP.NET Core

I have a fairly simple website that I am playing with using ASP.NET Core. I am running the application from the command line and the website is returning static files but I keep getting 500 errors when I attempt to make a request that should get handled by MVC. How do I see what the error is? Whether the error is displayed to the browser or logged to the console doesn't matter I just want a way to see what the error is.

like image 322
runxc1 Bret Ferrier Avatar asked Jul 03 '14 21:07

runxc1 Bret Ferrier


People also ask

How does ASP.NET Core handle global errors?

Use the UseExceptionHandler middleware in ASP.NET Core So, to implement the global exception handler, we can use the benefits of the ASP.NET Core build-in Middleware. A middleware is indicated as a software component inserted into the request processing pipeline which handles the requests and responses.

How does ASP.NET handle errors?

You can handle default errors at the application level either by modifying your application's configuration or by adding an Application_Error handler in the Global. asax file of your application. You can handle default errors and HTTP errors by adding a customErrors section to the Web. config file.


1 Answers

Add the error page middleware as shown here:

app.UseDeveloperExceptionPage(); 
like image 132
Victor Hurdugaci Avatar answered Sep 24 '22 04:09

Victor Hurdugaci