The SSL connection could not be established, see inner exception
То получаю эту ошибку, то нет. Как её избежать ?
System.Net.Http.HttpRequestException: "The SSL connection could not be established, see inner exception."
Внутренние исключение IOException: Received an unexpected EOF or 0 bytes from the transport stream.
// Создание экземпляра класса System.Net.Http.HttpClientHandler.
HttpClientHandler httpClientHandler = new()
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate | DecompressionMethods.Brotli,
AllowAutoRedirect = true
};
// Создание экземпляра класса для отправки HTTP-запросов и получения HTTP-ответов
HttpClient httpClient = new(httpClientHandler);
HttpRequestMessage request = new(HttpMethod.Post, "https://скрыл");
request.Content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("скрыл", "скрыл"),
new KeyValuePair<string, string>("скрыл", "скрыл"),
new KeyValuePair<string, string>("скрыл", "скрыл"),
new KeyValuePair<string, string>("скрыл", "скрыл")
});
HttpResponseMessage response;
try
{
response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseContentRead);
}
catch (Exception e)
{
Logger.WriteLog($"скрыл", e.Message);
throw;
}
