We wanted to share our recent experience when we suddenly encountered an error when trying to connect to Dynamics CRM 365 v9.0 (July Preview) from our custom web portal. The same code had been working since last so many days and suddenly one morning we get the error:
“Unable to Login to Dynamics CRMOrganizationWebProxyClient is nullOrganizationWebProxyClient is nullOrganizationServiceProxy is nullOrganizationServiceProxy is null” while connecting to Dynamics CRM 365 in the Online environment using Xrm.Tooling.Connector CrmServiceClient”
We then checked our other solution that was connecting to other CRM instances and found that CRM 2016/ 365 online were working fine.
We then checked our other solution that were connecting to other CRM instances and found that CRM 2016/ 365 online were working fine.
We explored various possible options for this error such as:
- Changing Xrm connection string to include the unique organization name instead of friendly CRM organization (https://community.dynamics.com/crm/b/misscrm360exploration/archive/2017/02/15/error-quot-unable-to-login-to-dynamics-crmorganizationwebproxyclient-is-nullorganizationwebproxyclient-is-nullorganizationserviceproxy-is-nullorganizationserviceproxy-is-null-quot-during-connecting-to-crm-online-using-xrm-too ) name as shown below.
- Update the CRM SDK to the latest 9.0 assemblies as suggested in the link http://www.mscrmtutorial.com/2017/09/unable-to-login-to-dynamics.html.
- Tried another option which suggested to create a new user with admin rights and use that in the connection string. https://community.dynamics.com/enterprise/f/759/t/230649
None of these worked for us and then one of our team mate pointed us the avowal from Microsoft that “All client-server and browser-server combinations must use TLS 1.2 or later protocol versions to be able to connect without issues to Office 365 services. This may require certain client-server and browser-server combinations to be updated. Although current analysis of connections to Microsoft Online services shows that very few customers still use TLS 1.0 and 1.1, we are providing notice of this change so that you can update any affected clients or servers as necessary before support for TLS 1.0 and 1.1 is disabled.
If you are using any on-premises infrastructure for hybrid scenarios or Active Directory Federation Services, make sure that these infrastructures can support both inbound and outbound connections that use TLS 1.2.”
This essentially means that if your client/server machine is not configured with TLS 1.2 protocol, it will not allow you to connect to CRM.
So, we needed to invoke the TLS1.2 protocol in our web application before instantiating the CrmServiceClient class to establish the connection. The same can be done either by using the ServicePointManager’s security protocol found under System.Net namespace.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
or upgrading the Microsoft.Net framework to version 4.6.2 which can handle this issue internally.
Once you add this and now connect the connection is created without any problems.
You should try various options as suggested (in other links) and should surely update to latest assemblies. We assume that this TLS restriction will be slowly rolled out to other instances and this will need to be incorporated. Hope this helps.