System.Security.Authentication.AuthenticationException:根据验证过程,远程证书无效

时间:2019-07-05 11:43:24

标签: c# .net ssl asp.net-web-api

我用Microsoft安装程序项目制作了一个安装程序,该项目运行一个exe,该exe下载一个zip文件,将其解压缩,然后从解压缩的文件夹中运行一个exe。

提取的文件夹中的exe从Web api发出请求。 Web API在本地主机上。 exe在此行引发异常

CM_Get_Device_Interface_List()

但是如果我从解压缩的文件夹中手动运行exe,它运行得很好,不会引发任何异常。

我已经尝试过了

response = client.GetAsync(URL).result();

还有这个

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

这些都不适合我。

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

0 个答案:

没有答案