一个应用程序在netcore2.1.5,win7上运行。
无法建立SSL连接,请参阅内部异常。 身份验证失败,请参阅内部异常
内部异常内容:
System.ComponentModel.Win32Exception(0x80090326):接收到的消息异常,或格式不正确。
英语版本:
“收到的消息不正常或格式不正确”
我在下面的代码:
string clientCertfile = @"E:\https\client.crt";
var client = new RestClient("https://apiserver/iocm/app/sec/v1.1.0/login");
X509Certificate2 certificates = new X509Certificate2(clientCertfile);
//X509Certificate2 certificates = GetMyX509Certificate(clientCertfile);
client.ClientCertificates = new X509Certificate2Collection(){ certificates };
client.RemoteCertificateValidationCallback =
new RemoteCertificateValidationCallback(OnRemoteCertificateValidationCallback);
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("appId", "rIsyJsnMtOrKfpSO90");
request.AddParameter("secret", "8v0fH0ztunjP1oXT");
IRestResponse response = client.Execute(request);