I have been using the Partner wsdl to connect to SalesForce from my C# application for a few years. When I found out that SalesForce was turning off TLS 1.0, I did some reading and found out that updating my C# application to the .NET 4.6 Framework should get it to use TLS 1.1 or TLS 1.2, so problem solved? No.
When I run a Login History report in SalesForce, my application looks like it is still using TLS 1.0. I can’t seem to figure out why.
I rebuilt my application from scratch on .NET 4.6 thinking that maybe when I upgraded there was something hanging around forcing TLS 1.0. The login history report in SalesForce still reports that my app is using TLS 1.0.
I’ve downloaded the latest version of the Partner wsdl and that didn’t fix anything either.
Any help would be greatly appreciated.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
You can force you C# application to only use TLS 1.2 by adding the following line before making the connection to Salesforce:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
In general usage you would typically include a
| SecurityProtocolType.Tls11 with that line as well.
If it still isn’t working, check the operating system level support for TLS 1.2 as well. For instance, Windows Server 2012 and earlier and Windows 8 and earlier may not support TLS 1.1 and higher unless IE 11 is installed. See Salesforce disabling TLS 1.0
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0