Home > Net >  <span> data - v - 93948064 HttpClient SSL certificates cannot be trusted </span>
<span> data - v - 93948064 HttpClient SSL certificates cannot be trusted </span>

Time:09-02

I need to use a console program in a network server to access a HTTPS website

The following

code

The  var handler & # 61; New WebRequestHandler ();Handler. ServerCertificateValidationCallback & # 61; The delegate {Console. WriteLine (& # 34; Set the trust certificate & # 34;); return true; };Var httpClient & # 61; New HttpClient (handler);HttpClient. BaseAddress & # 61; New Uri (& # 34; https://www.baidu.com");Var response & # 61; Await httpClient. GetAsync (& # 34; https://www.baidu.com");  

but still quote us when get The request was aborted: Could not create The SSL/TLS secure channel error

console also does not have to print out & # 34; Set the trust certificate & # 34; When the get request and not to enter the entrust of

The  ServicePointManager. ServerCertificateValidationCallback & # 61; The delegate {Console. WriteLine (& # 34; Set the trust certificate & # 34;); return true; };  

this setting also didn't effect

I would like to ask whether there is relevant in the server Settings? Such as a total ban on the SSL network authentication certificate; Or in the code you need to add other attributes?

the server environment is a Windows server 2008. The.net version 4.5

  •  Tags:  
  • Related