The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch
因为证书是绑定域名的,用IP地址访问会报证书校验失败,可以通过如下代码跳过客户端证书检查。
HttpClientHandler clientHandler = new HttpClientHandler(); clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, SslPolicyErrors) => { return true; }; HttpClient client = new HttpClient(clientHandler);