title: How to make windows store app work with TLS 1.2?
body: <p>There is a windows store app 8.1 connected to a web service via WCF. Recently TLS 1.2 has been set at the server and as a result the app stopped working. Here is the exception</p>
  
  <blockquote>
    <p>An error occurred while making the HTTP request to
    <a href="https://services.companyname.com">https://services.companyname.com</a> This could be due to
    the fact that the server certificate is not configured properly with
    HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of
    the security binding between the client and the server.</p>
  </blockquote>
  
  <p>Even a simple web request</p>
  
  <pre><code>WebRequest request = WebRequest.Create(SERVER_URL_PROD);
  WebResponse response = await request.GetResponseAsync();
  </code></pre>
  
  <p>returns the following</p>
  
  <blockquote>
    <p>An exception of type 'System.Net.WebException' occurred in
    mscorlib.dll but was not handled in user code</p>
    
    <p>Additional information: The underlying connection was closed: An
    unexpected error occurred on a send.</p>
  </blockquote>
  
  <p>So how to make windows store app work with TLS 1.2 ?</p>
  
  <p><strong>Update</strong></p>
  
  <p>The code above works in a console app (.NET 4.5) if </p>
  
  <pre><code> ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  </code></pre>
  
  <p>But <code>ServicePointManager</code> is not available for Windows Store apps</p>
  
  <p><strong>Update 2</strong></p>
  
  <p>Moreover the code works in Windows Phone 8.1 where <code>ServicePointManager</code> is <strong>not</strong> available.</p>