主要在于修改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();
```
2501


参考解决方案&spm=1001.2101.3001.11974&articleId=129405741&d=1&t=3&u=fdcf41045c4b4c86bcd129c7421b2259)

被折叠的 条评论
为什么被折叠?



