Sunday, January 07, 2018

Fix for unable to login to Dynamics CRM 9.0 with CrmServiceClient and .NET 4.7

When you try to connect to Dynamics 365 9.0 from within a console app using the CrmServiceClient, you might still encounter an error “Unable to login to Dynamics CRM” even though you have updated to the latest version of the different assemblies (9.0.0.7 at the moment of writing).

This might be caused by the fact that you compiling against .NET 4.7 where the default value of the ServicePointManager.SecurityProtocol is SecurityProtocolType.SystemDefault (See What’s new in .NET 4.7 for more details).

If this is the fact, you might need to explicitly change the protocol to TL1.2 - which is a requirement for Dynamics 365 9.0 as announced in September 2017 in Updates coming to Dynamics 365 Customer Engagement connection security  - by adding a line ServicePointManager.SecurityProtocol.SecurityProtocol = SecurityProtocolType.Tls12


No comments:

Post a Comment