主要在于修改HttpClientHandler的内容,以使用HttpRequest为例:
```Csharp
// Generate request message
var httpRequest = new HttpRequestMessage(HttpMethod.Post, ApiUri);
httpRequest.Headers.Add("host", Host);
httpRequest.Content = new StringContent(Body,
null,
"application/json");
// Create new handler with ignoring all certificate errors
var handler = new HttpClientHandler();
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
handler.ServerCertificateCustomValidationCallback =
(httpRequestMessage, cert, cetChain, policyErrors) =>
{
return true;
};
// Add handler into client
var client = new HttpClient(handler);
// Send reqeust
var response = client.Send(httpRequest);
Result = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
```