Page 1 of 1

Could not establish secure channel for SSL/TLS with authority 'login.salesforce.com'

Posted: Tue 28 Jul 2015 14:50
by brucecallen
I am getting an intermittent error
Could not establish secure channel for SSL/TLS with authority 'login.salesforce.com'
. I have a windows service which runs every 5 minutes and queries SalesForce. It works most of the time but more and more often I am getting the above error throughout the day.

Here is the stack trace:
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Here is my connection string:
<add name="SalesForceConnection" connectionString="metadata=res://*/SalesForceDataModel.csdl&#xD;&#xA; |res://*/SalesForceDataModel.ssdl&#xD;&#xA; |res://*/SalesForceDataModel.msl;&#xD;&#xA; provider=Devart.Data.Salesforce;&#xD;&#xA; provider connection string="User Id=[email protected];Password=ssssss;Security Token=9999999999;Client Id=AFG.RemarketingService;Persist Security Info=True;Host=login.salesforce.com;Data Cache=1.db;Metadata Cache=1_metadata.db;"" providerName="System.Data.EntityClient"/>
Thank you
Bruce

Re: Could not establish secure channel for SSL/TLS with authority 'login.salesforce.com'

Posted: Wed 29 Jul 2015 06:52
by Shalex
Salesforce doesn't support SSL anymore: https://help.salesforce.com/apex/HTView ... uage=en_US. Please check your project (or environment settings) to find out a piece of code which switches application to using SSL3.

Try setting security protocol explicitly:

Code: Select all

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
JIC: refer to the discussion at http://stackoverflow.com/questions/2828 ... in-net-4-5.