title: Can't download files from the computer with enabled TLS 1.1/1.2 protocols using WebClient.DownloadFile method
body: <p>I'm trying to implement a simple console application to download the files using Webclient.DownloadFile method over TLS 1.1/1.2 protocols.
  This is the code for the application:</p>
  
  <pre><code>var downloadUrl = "https://serverURL.com/sample.mp3";
  var filename = "sample.mp3";
  var myWebClient = new WebClient();
  myWebClient.DownloadFile(downloadUrl, filename);
  </code></pre>
  
  <p>Everytime I run it I'm getting the following error message:</p>
  
  <pre><code>Unhandled Exception: System.Net.WebException: 
  The underlying connection was closed: An unexpected error occurred on a receive. ---&gt;   
  
  System.ComponentModel.Win32Exception: The client and server cannot communicate, because they do not possessa common algorithm
  at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)
  at System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential&amp; secureCredential)
  at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]&amp; thumbPrint)
  at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]&amp; output)
  at System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)
  at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
  at System.Net.TlsStream.CallProcessAuthentication(Object state)
  at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
  at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
  at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
  at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
  at System.Net.ConnectStream.WriteHeaders(Boolean async)
  --- End of inner exception stack trace ---
  at System.Net.WebClient.DownloadFile(Uri address, String fileName)
  at System.Net.WebClient.DownloadFile(String address, String fileName)
  at web_downloader.Program.Main(String[] args) in c:\Users\user\Documents\Visual Studio 2013\Projects\web_downloader\web_downloader\Program.cs:line 27
  </code></pre>
  
  <p>I have the following setup: web_downloader application is located on <strong>ServerA</strong> (Windows Server 2012 R2/64bit), which has the following in the registry key under <strong>HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols</strong>:</p>
  
  <pre><code>PCT 1.0
  --Client
  ----DisabledByDefault=1
  ----Enabled=0
  --Server
  ----DisabledByDefault=1
  ----Enabled=0
  SSL 2.0
  --Client
  ----DisabledByDefault=1
  ----Enabled=0
  --Server
  ----DisabledByDefault=1
  ----Enabled=0
  SSL 3.0
  --Client
  ----DisabledByDefault=1
  ----Enabled=0
  --Server
  ----DisabledByDefault=1
  ----Enabled=0
  TLS 1.0
  --Client
  ----DisabledByDefault=1
  ----Enabled=0
  --Server
  ----DisabledByDefault=1
  ----Enabled=0
  TLS 1.1
  --Client
  ----DisabledByDefault=0
  ----Enabled=1
  --Server
  ----DisabledByDefault=0
  ----Enabled=1
  TLS 1.2
  --Client
  ----DisabledByDefault=0
  ----Enabled=1
  --Server
  ----DisabledByDefault=0
  ----Enabled=1
  </code></pre>
  
  <p>And <strong>ServerB</strong>, which stores <strong>sample.mp3</strong> file, has the following:</p>
  
  <pre><code>SSL 2.0
    Client
      DisabledByDefault=1
  TLS 1.1
    Client
      DisabledByDefault=0
      Enabled=1
    Server
      DisabledByDefault=0
      Enabled=1
  TLS 1.2
    Client
      DisabledByDefault=0
      Enabled=1
    Server
      DisabledByDefault=0
      Enabled=1
  </code></pre>
  
  <p>As soon as I enable TLS 1.0 on <strong>ServerA</strong> I'm able to download the mp3 file from <strong>ServerB</strong> (Windows 7/64bit/Net Framework 4.5.1) without any issues.</p>
  
  <p><strong>System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing</strong> policy is disabled on both machines.</p>
  
  <p>Am I missing any configuration parameters for DownloadFile method to work with TLS 1.1/1.2?</p>