CRM 2015 + Metadata contains a reference that cannot be resolved RRS feed

  • Question

  • Hi,

    I have created a console application that connects to CRM and updates a field in an XYZ entity.

    The code to connect to CRM is  -

     ClientCredentials credential = new ClientCredentials();
     credential.UserName.UserName =user;
     credential.UserName.Password = password;

     OrganizationServiceProxy proxy = new OrganizationServiceProxy(new Uri(crmEnvironments.ElementAt(currentEnvironment).URL), null, credential, null);

    It connects to CRM well initially but after sometime it throws the below mentioned error - 

    "Metadata contains a reference which could not be resolved". 

    Inner Exception : "Unable to connect to Remote Server"

    After doing some research on google , i did the following the things

    Inserted the following line of code in Connect CRM - 

     ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain,SslPolicyErrors sslPolicyErrors) { return true; };

    Inserted the following in the Appconfig file - 

        <defaultProxy useDefaultCredentials="true">


    However the error still exists, after processing some records the connection fails and throws the above mentioned error.

    Please help.

    Saturday, April 16, 2016 2:10 PM