. NET WebAPI correctly throws error details

Source: Internet
Author: User

Recently, the previous WebAPI project was released to the server, and the database was changed from SQL Server2008 EXPRESS to SQL Server2000. However, when querying by page, the server throws a "500 error ", however, the error details are not displayed.CustomErrorsThe detailed information is still not displayed. Because the project is published on the server, there is no way to debug it, and the server is windows20003, the page cannot be remotely debugged, write try... Catch... Capture the error in the action and throw it. The error still cannot be obtained. If the error details are not obtained, the error is not modified. Then, search for a solution on the Internet to find a WebAPI error, only 500 is thrown, and no detailed information is contained. The error details can be obtained only when HttpResponseException is thrown. The Code is as follows:

Resp =

Finally, according to the error details, we found that the new version of nhib.pdf does not support SQL Server2000 paging queries, and another SQL Server2005 error solution is installed.

When I wrote this record, I just thought that it would not be so troublesome. I could output the detailed content of the Exception directly and make a detour...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.