self signed cert. The underlying connection was closed: Could not establish trust relationship

前端 未结 2 1790
醉梦人生
醉梦人生 2020-12-17 19:25

Trying to set up a self signed certificate, for our intranet\'s web services site. The certificate itself shows it is \"ok\" but when trying to invoke a method from the web

2条回答
  •  星月不相逢
    2020-12-17 19:35

    Add this line of code somewhere before you create your service client.

    ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
    

    Do note: this will cause your app to accept all invalid certs and just keep moving. If this is not acceptable, you can attach a function to that and do processing to determine if the cert error is ok or not

提交回复
热议问题