Enable Tls 1.1 or Tls 1.2 on WCF 4.0

Windows Communication Foundation 4.0 support Ssl3/Tls1.0 out-of-the-box. If you need to support Tls1.1 or Tls1.2, you must update to .NET Framework 4.6. If you can’t do that, try the following workaround just before establish the secure connection:

Set the SecurityProtocol to 768 if you want to use Tls1.1

System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)768;

or set to 3072 if you want to use Tls1.2

System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;

Note

Be sure to have .NET Framework 4.5 or above installed on the client machine!

Enjoy!

Found a problem? Edit this post