We are trying post the logs in Elasticsearch, but getting the below error from .net core. please guide me how to solve this error.
using (var handler = new HttpClientHandler())
{
handler.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls;
X509Certificate2 certificate1 = new X509Certificate2(@"path/certifi.cer");
handler.ClientCertificates.Add(certificate1);
using (var client = new HttpClient(handler))
{
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
jsonstr = JsonConvert.SerializeObject(cur);
var content = new StringContent(jsonstr, Encoding.UTF8, "application/json");
var response = await client.PostAsync(LogServer, content);
res = await response.Content.ReadAsStringAsync();
if (res != "OK")
{
throw new Exception("Send to log server failed: res:" + res);
}
}
}