title: Serilog.Sink.Elasticsearch, Could not create SSL/TLS secure channel
body: <p>I am using Serilog and Serilog.Sink.Elasticsearch in an ASP web API project,
  there is an issue with the connection to the ELK service that has been configured on an azure Kubernetes cluster, I get the error below when I deploy my code on the windows server 2012 R2, but it works on my desktop correctly, and SSL has been issued by LetsEncrypt and expiration time is fine</p>
  <p>packages:</p>
  <pre><code>  &lt;package id=&quot;Microsoft.AspNet.WebApi&quot; version=&quot;5.2.3&quot; targetFramework=&quot;net452&quot; /&gt;
    &lt;package id=&quot;Serilog&quot; version=&quot;2.10.0&quot; targetFramework=&quot;net472&quot; /&gt;
    &lt;package id=&quot;Elasticsearch.Net&quot; version=&quot;7.17.0&quot; targetFramework=&quot;net472&quot; /&gt;
    &lt;package id=&quot;Serilog.Sinks.Elasticsearch&quot; version=&quot;8.4.1&quot; targetFramework=&quot;net472&quot; /&gt;
  </code></pre>
  <p>error:</p>
  <blockquote>
  <p>2022-04-06T11:49:33.7509141Z Caught exception while preforming bulk
  operation to Elasticsearch:
  Elasticsearch.Net.ElasticsearchClientException: The request was
  aborted: Could not create SSL/TLS secure channel.. Call: Status code
  unknown from: POST /_bulk ---&gt; System.Net.WebException: The request
  was aborted: Could not create SSL/TLS secure channel.</p>
  <p>at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult
  asyncResult)</p>
  <p>at
  System.Threading.Tasks.TaskFactory<code>1.FromAsyncCoreLogic(IAsyncResult iar, Func</code>2 endFunction, Action<code>1 endAction, Task</code>1 promise, Boolean
  requiresSynchronization)</p>
  <p>--- End of stack trace from previous location where exception was thrown ---</p>
  <p>at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()</p>
  <p>at
  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
  task)</p>
  <p>at
  Elasticsearch.Net.HttpWebRequestConnection.d__5`1.MoveNext()</p>
  <p>--- End of inner exception stack trace ---</p>
  <p>at
  Elasticsearch.Net.Transport`1.HandleElasticsearchClientException(RequestData
  data, Exception clientException, IElasticsearchResponse response)</p>
  <p>at
  Elasticsearch.Net.Transport<code>1.FinalizeResponse[TResponse](RequestData requestData, IRequestPipeline pipeline, List</code>1 seenExceptions,
  TResponse response)</p>
  <p>at Elasticsearch.Net.Transport<code>1.&lt;RequestAsync&gt;d__15</code>1.MoveNext()</p>
  <p>--- End of stack trace from previous location where exception was thrown ---</p>
  <p>at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()</p>
  <p>at
  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
  task)</p>
  <p>at
  Serilog.Sinks.Elasticsearch.ElasticsearchSink.d__2.MoveNext()</p>
  </blockquote>
  <p>I've added these lines to Application_Start but it doesn't work me:</p>
  <pre><code>ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;
              ServicePointManager.Expect100Continue = true;
  </code></pre>
  <p>Any thoughts?</p>