Error connecting to Online Dynamics 365 {Unable to Login to Dynamics CRM OrganizationWebProxyClient is null}
While connecting to online dynamics CRM 365 (Version 1710 (9.0.2.1465)) through "Microsoft.Xrm.Tooling.Connector"
I got the above error. I was trying to connect using visual studio 2017.
Below was my code behind.
var connectionString = ConfigurationManager.ConnectionStrings["Xrm"].ConnectionString; CrmServiceClient _crmSvc = new CrmServiceClient(connectionString); IOrganizationService crmservice = _crmSvc.OrganizationServiceProxy;
Following is app.conconfig setting
<?xml version="1.0" encoding="utf-8"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/> </startup> <connectionStrings> <add name="Xrm" connectionString="Url=https://buildme.crm8.dynamics.com; AuthType=Office365; Username=my@buildme.onmicrosoft.com; Password=pass@word1"/> </connectionStrings> </configuration>
I used following approaches to resolve the issue.But nothing worked and error continued to occur. 1. I used latest SDK dll 2. I used (ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;) before instantiating CrmServiceClient . 3.I used unique organization name in connection string. 4.I moved to .Net framework Version=v4.6.2. Error Resolution: I tried connecting CRM with Xrmtoolbox and i saw below error in log file. "Error : The security timestamp is stale because its expiration time ('2018-08-22T15:59:40.256Z') is in the past. Current time is '2018-08-24T18:52:45.924Z' and allowed clock skew is '00:05:00'" Solution: I have updated my system time which was ahead with the CRM online user Timezone. This fixed the crm connection issue and i was able to connect. Hope it helps.