How to display errors with ASP.NET Core

前端 未结 4 1282
故里飘歌
故里飘歌 2020-12-10 10:06

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

4条回答
  •  清歌不尽
    2020-12-10 10:53

    If you don't care that your error details would be exposed to the world, you can enable the error details, right in the browser without any code changes. (This was only tested in IIS 8.5):

    • In IIS Manager, in the left Connections section, left-click select your Site.
    • In the right side Feature View open Error Pages.
    • On the far right Actions section, click on Edit Feature Settings
    • In the Error Responses, select the 2nd, Detailed errors, option then Ok (or if you are worried about exposing stuff to the world, start with the 3rd option, if you can open a local browser... ie, localhost:...)

    This should be enough for you to be able to see the exact error... Important: If you had to use the middle Detailed errors option, be sure to turn it off once you debug the problem. This can give a hacker all he needs to break into your server.

提交回复
热议问题