我有一个https URL来访问https://*****omi.com/ws/rest/security/v1/ActivateSecurityUser,这需要通过证书.cert文件和.key文件进行认证。
我正在使用下面的代码通过带有webrequesthandler的URL获取证书的响应。
X509Certificate2 certificate = new X509Certificate2(cert, key);
WebRequestHandler handler = new WebRequestHandler();
handler.ClientCertificates.Add(certificate);
client = new HttpClient(handler);
response = client.PostAsync(uri, content).Result;
return response;
我遇到错误
----> System.Net.Http.HttpRequestException : An error occurred while sending the request.
----> System.Net.WebException : The underlying connection was closed: An unexpected error occurred on a send.
----> System.IO.IOException : Authentication failed because the remote party has closed the transport stream.
这对邮递员来说很好用。请让我知道我在这里想念的是什么。谢谢。