locked
New CRM Connection code causing errors RRS feed

  • Question

  • I am trying to create a console application that connects to CRM 2016 (On Prem) using the 2016 SDK.

    The below code fails. The conn.LastCrmError has the following details and the orgService is null.

    Unable to Login to Dynamics CRMOrganizationWebProxyClient is null OrganizationServiceProxy is null OrganizationWebProxyClient is null OrganizationServiceProxy is null.

    var connectionString = @"Url=http://xxxx/xxxx/; Username=xxxx; Password=xxxx;";
                CrmServiceClient conn = new CrmServiceClient(connectionString);
                IOrganizationService orgService = conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

    The connection works I run old code below using the 2015 SDK

                var connectionString = @"Url=http://wxxxxx/xxxx/; Username=xxxxx; Password=xxxxx;";
                IOrganizationService orgService2 = new OrganizationService(CrmConnection.Parse(connectionString));
                var results = orgService2.Execute(new WhoAmIRequest());

    Any suggestions on how to resolve this?


    Friday, September 30, 2016 3:27 AM

All replies

  • Did you ever get this solved? I am experiencing the same problem.
    Thursday, September 28, 2017 3:23 PM
  • Hi,

    You are "newing up" the CrmServiceClient but not the OrganizationWebProxyClient object or the others for that matter.

    Try instantiating the subclasses that you need.

    regards,

    Don

    Thursday, October 5, 2017 3:01 AM