Monday 8 January 2018

Authentication Issue with Web App for Dynamics 356 v9

I was unable to connect to Dynamics 356 Customer Engagement through a web application.
There were different errors I got based on the method used to connect to CRM

For Xrm.Tooling.Connector
Error message: OrganizationServiceProxy is null
LastCrmError: "Unable to Login to CRM OrganizationServiceProxy is null"

For Web service OrganizationService
Error: Metadata contains a reference that cannot be resolved: ‘https://***.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl&sdkversion=9

During my search for a resolve, which took me days, I stumbled upon this blog
Abhinav Ranjan

Following this link by Microsoft New features of Dynamics 365 Customer Engagement. It explained the possible ways to resolve it.

Adding this piece of code before authentication resolves the issue

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12