Only on azure: Could not create SSL/TLS secure channel
<p>I run an application on the Azure application Standard: 1 Small plan. Framework is 4.6.1</p>

<p>This application is calling a SSL secured API. The SSL is published by StartCom Class 1 DV Server CA, my local browser tells me that the certificate is valid.</p>

<p>If I run the application on my local machine everything works. However, when deployed to azure it fails with follwing error:</p>

<blockquote>
  <p>System.Net.Http.HttpRequestException: An error occurred while sending
  the request. ---> 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.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult
  ar)</p>
  
  <p>--- End of inner exception stack trace ---</p>
  
  <p>at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
  task)</p>
  
  <p>at
  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
  task)</p>
</blockquote>

<p>The code:</p>

<pre><code>public async Task&lt;List&lt;QutationOverview&gt;&gt; GetAll(string url, DateTime lastActionDate)
    {
        var result = string.Empty;

        try
        {


            var userName = await _settingManager.GetSettingValueAsync("API.UserName");
            var password = await _settingManager.GetSettingValueAsync("API.Password");


            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls |
                                                   SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;


            ServicePointManager
                .ServerCertificateValidationCallback +=
                (sender, cert, chain, sslPolicyErrors) =&gt; true;


            //Add date filter
            //Always request qutations where the last action took place &gt;= Yesterday
            var requestUrl =
                $"GetALL/?last_action_date={lastActionDate.AddDays(-1).ToString("yyyy-MM-dd")}&amp;format=json";


            var baseAddress = new Uri(url);
            var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{userName}:{password}"));

            Logger.InfoFormat("GetAllQuotationsAsync for url {0}{1}", url, requestUrl);

            using (var httpClient = new HttpClient {BaseAddress = baseAddress})
            {
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials);
                using (var response = await httpClient.GetAsync(requestUrl))
                {
                    result = await response.Content.ReadAsStringAsync();
                    Logger.Info(result);
                }
            }
        }

        catch (Exception ex)
        {
            Logger.ErrorFormat("GetAllQuotationsAsync {0}: {1}", url, ex);
        }
        var data = JsonConvert.DeserializeObject&lt;List&lt;QutationOverview&gt;&gt;(result);

        return data;
    }
</code></pre>

<p>As you can see I skip the validation of the certificate and added the security protocols. </p>

<p>However, the request is still failing.</p>

<hr>

<p>Here is the caputred response
<a href="http://textuploader.com/5ers0" rel="noreferrer">http://textuploader.com/5ers0</a></p>

<hr>

<p>Do you have any idea how to get this one working on Azure?</p>