Friday, February 19, 2016

MS CRM 2016 Metadata contains a reference that cannot be resolved: 'http://ServerAddress/OrganizationName/XRMServices/2011/Organization.svc?wsdl=wsdl0'. There is an error in XML document (1, 1243).

Microsoft Dynamics CRM 2016

Exception Messages

[System.InvalidOperationException] "Metadata contains a reference that cannot be resolved: 'http://********************/******/XRMServices/2011/Organization.svc?wsdl=wsdl0'."

 

InnerException {"The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 1243."} System.Exception {System.Xml.XmlException}

 

Message "There is an error in XML document (1, 1243)." string

 

How and When Problem Occurs

I recently installed Microsoft Dynamic CRM 2016 on one of our Development environment.

I have some custom tool which connect to MS CRM.

I give it a try to run my tool who was having MS CRM 2013 SDK Dll’s.

I got an exception when I tried to execute a Core CRM operation.

 

For Example : Refer to highlighted text in below code.

public static IOrganizationService getOrgnizationService()

{

try

{

string environment = ConfigurationManager.AppSettings["Environment"];

 

// using ConnectionString Name

CrmConnection connection = new CrmConnection(environment);

OrganizationService proxy = new OrganizationService(connection);

 

WhoAmIRequest request = new WhoAmIRequest();

WhoAmIResponse response = (WhoAmIResponse)proxy.Execute(request);

 

return proxy;

}

catch (Exception ex)

{

throw ex;

}

}

Exception :

{"Metadata contains a reference that cannot be resolved: 'http://03rnb-***************:5555/afcrmcustomercentral/XRMServices/2011/Organization.svc?wsdl=wsdl0'."}

Inner Exception : {"There is an error in XML document (1, 1243)."}

Solution :

When connecting to MS CRM 2016, we need to refer MS CRM 2016 SDK DLL’s.

Microsoft.Xrm.Sdk version – 8.0.0.0

Microsoft.Crm.Sdk.Proxy version – 8.0.0.0

You can download MS CRM 2016 SDK from here.

Note :

MS CRM 2016 SDK require minimum .NET Framework 4.5.2 to be installed in your Visual Studio.