Debugging failing HTTPS WebRequest

后端 未结 3 929
南笙
南笙 2020-12-03 08:16

I\'m writing a small program which will make a GET request to a server using HTTPS and the HttpWebRequest class. The server (obviously) has a server certificate. It also exp

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 09:08

    I agree with Markus's solution above. I once had a similar issue, and I found that the best thing to do is get that exception under a debugger.

    If you can run a build locally and look at that exception in the debugger, you have to drill down several levels before you get to the real meat of the issue.

    In the case I'm thinking of, I had to look through 4 or 5 innerExceptions before I got to the message that told me specifically what was wrong.

    I found that this tends to be true in many cases in .Net generally - you will get an exception which has a very generic error message, and you need to dive several "innerException" levels down before you get to the meat of the issue.

    Hope this helps.

提交回复
热议问题