The request was aborted: Could not create SSL/TLS secure channel

后端 未结 30 1821
遇见更好的自我
遇见更好的自我 2020-11-22 01:21

We are unable to connect to an HTTPS server using WebRequest because of this error message:

The request was aborted: Could not create SSL/TLS secur

30条回答
  •  囚心锁ツ
    2020-11-22 01:45

    "The request was aborted: Could not create SSL/TLS secure channel" exception can occur if the server is returning an HTTP 401 Unauthorized response to the HTTP request.

    You can determine if this is happening by turning on trace-level System.Net logging for your client application, as described in this answer.

    Once that logging configuration is in place, run the application and reproduce the error, then look in the logging output for a line like this:

    System.Net Information: 0 : [9840] Connection#62912200 - Received status line: Version=1.1, StatusCode=401, StatusDescription=Unauthorized.
    

    In my situation, I was failing to set a particular cookie that the server was expecting, leading to the server responding to the request with the 401 error, which in turn led to the "Could not create SSL/TLS secure channel" exception.

提交回复
热议问题