CrmServiceClient cannot establish connection to 2 different systems RRS feed

  • Question

  • I have some code that reads data from one CRM system and writes to another. 

    I have been trying to use two instances of CrmServiceClient to connect, but -- very bizzare -- both instances of CrmServiceClient are to the first system connected to!

    I.e there are two CrmServiceClient objects, created with two different connection strings: _crmSourceSvc and _crmDestinationSvc. But after connecting the _crmSourceSvc (which works fine), when I create a new object (_crmDestinationSvc) it IGNORES the connection string I pass to it in the constructor, and returns an object pointing to the same system as _crmSourceSvc!! No errors, nothing, it just does it. There is a pause when _crmSourceSvc connects, but the call for _crmDestinationSvc returns immediately.

    Code snippet below:

            CrmServiceClient _crmSourceSvc = null;
            CrmServiceClient _crmDestinationSvc = null;
            string sourceConnectionString = ConfigurationManager.ConnectionStrings["myproject.Properties.Settings.Source"].ToString();
            _crmSourceSvc = new CrmServiceClient(sourceConnectionString);
            string destinationConnectionString = ConfigurationManager.ConnectionStrings["myproject.Properties.Settings.Destination"].ToString();
             _crmDestinationSvc = new CrmServiceClient(destinationConnectionString);

    And here are the connection strings I'm using (removing senstive information). The point is they refer to two completely separate CRM deployments.

    <add name="myproject.Properties.Settings.Source" connectionString="AuthType=IFD;Url=https://crm.MYDOMAIN.com/crm; Username=MYUSERNAME;Password=MYPASSWORD;Domain=MYDOMAIN" />
    <add name="myproject.Properties.Settings.Destination" connectionString="Url=https://dmtest.ANOTHERDOMAIN.com/dmtest; Username=ADIFFERENTUSER; Password=DIFFERENTPASSWORD; AuthType=IFD" />

    Both systems are CRM 2016 Update 1.

    Any one ever tried this? Or can explain what is going on? 

    • Edited by DaymonN Wednesday, January 11, 2017 8:11 AM
    Wednesday, January 11, 2017 8:08 AM

All replies