0
Answered

The maximum nametable character count quota (16384) has been exceeded while reading XML data

Carol Wapshere 3 years ago in UNIFYBroker/Microsoft Dynamics CRM updated by anonymous 3 years ago 14

I am getting the following error when doing a "Test Connection" from IdB to CRM. The URI address resolves without cert errors in a browser. The CRM connector version is 5.2.0.1

Any idea what this means? 

Error An error has occurred: Metadata contains a reference that cannot be resolved: 'https://crm.service.address/DAMS/XRMServices/2011/Organization.svc?wsdl=wsdl0'.  Show Less

at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever)
at Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMetadata(Type contractType, Uri serviceUri, Boolean checkForSecondary)
at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Boolean checkForSecondary)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceConfiguration..ctor(Uri serviceUri)
at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateConfiguration[TService](Uri serviceUri)
at Unify.Product.IdentityBroker.OrganizationServiceCommunicator.GetOrganizationService(IAddressCommunicatorInformation communicatorInformation)
at Unify.Product.IdentityBroker.OrganizationServiceCommunicator.<>c__DisplayClass1_0.<.ctor>b__0()
at Unify.Product.IdentityBroker.AddressCommunicatorBase`2.get_Service()
at Unify.Product.IdentityBroker.DynamicsCrmAgent.TestConnection()
at Unify.Product.IdentityBroker.AgentEngine.Test(Guid agentId)
at Unify.Product.IdentityBroker.AgentEngineAuditingDecorator.Test(Guid agentId)
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClassc.<GetExecutor>b__6(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()

Inner Exception: An error has occurred: There is an error in XML document (1, 1127).
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Web.Services.Description.ServiceDescription.Read(XmlReader reader, Boolean validate)
at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.CreateMetadataSection(XmlReader reader, String sourceUrl)
at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)

Inner Exception: An error has occurred: 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 1127.
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowMaxNameTableCharCountExceeded(XmlDictionaryReader reader, Int32 maxNameTableCharCount)
at System.Xml.XmlBaseReader.QuotaNameTable.Add(Int32 charCount)
at System.Xml.XmlBaseReader.QuotaNameTable.Add(String value)
at System.Xml.Serialization.XmlSerializationReader.ToXmlQualifiedName(String value, Boolean decodeName)
at System.Web.Services.Description.ServiceDescriptionSerializationReader.Read117_Binding(Boolean isNullable, Boolean checkType)
at System.Web.Services.Description.ServiceDescriptionSerializationReader.Read124_ServiceDescription(Boolean isNullable, Boolean checkType)
at System.Web.Services.Description.ServiceDescriptionSerializationReader.Read125_definitions()
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

Affected Versions:
Fixed by Version:

Answer

Answer
Answered

Issue was resolved with packaged CRM SDK replaced with version 8.2 and the above binding redirect configuration. Issues with the binding redirect configuration were caused by Voice lower-casing all XML element and attribute names. Refer to above image for correct casing.

Under review

We haven't seen this before. Did you try searching Microsoft forums or raising a support ticket with Microsoft?

Hi Carol, IdB does use that SDK. It appears that the SDK dlls can be updated without issue so if you wish to try a newer version of the SDK, download it and replace the microsoft.crm.sdk.proxy.dll and microsoft.xrm.sdk.dll files in the services directory.

Those two DLLs are v5.x. Have replaced them with v8.x versions from the CRM SDK - but now IdB won't start:

Service cannot be started. Unify.Framework.UnifyServiceInitializeException: A agent of type Unify.Agent.DynamicsCRM was requested but is not in the list of known agents. Check agent is installed or agent configuration is correct. The currently known agents are: Unify.Agent.FTP, Unify.Agent.SqlServerDatabase, Unify.Agent.OracleDb, Unify.Agent.OleDb, Unify.Agent.AD ---> Unify.Framework.UnifyConfigurationException: A agent of type Unify.Agent.DynamicsCRM was requested but is not in the list of known agents. Check agent is installed or agent configuration is correct. The currently known agents are: Unify.Agent.FTP, Unify.Agent.SqlServerDatabase, Unify.Agent.OracleDb, Unify.Agent.OleDb, Unify.Agent.AD

   at Unify.Product.IdentityBroker.AgentEngine.GenerateAgent(IAgentConfiguration configuration)

   at Unify.Product.IdentityBroker.AgentEngine.InitializeFromXml(XDocument xml)

   at Unify.Product.IdentityBroker.AgentEngineAuditingDecorator.Initialize()

   at Unify.Framework.UnifyEngine`1.Initialize()

Updating the SDK DLL files makes the Agent disappear from Identity Broker. I have verified this as followed:

1. Removed all CRM related config from the Agent, Connector and Adapter files - Idb then starts, but when I attempt to create a new agent, CRM is not listed.

2. Service restarts etc make no difference.

3. Uninstalled and reinstalled the CRM connector - I can now see the CRM agent type listed.

4. Stop IdB service and update the two DLLs. Restart IdB service - the CRM Agent type has again disappeared from the list.


Add the following the the configuration/runtime/assemblyBindings element of the service configuration files:

<dependentassembly>
    <assemblyidentity name="Microsoft.Crm.Sdk.Proxy" publickeytoken="31bf3856ad364e35" culture="neutral"></assemblyidentity>
    <bindingredirect oldversion="0.0.0.0-8.0.0.0" newversion="8.0.0.0"></bindingredirect>
</dependentassembly>
<dependentassembly>
    <assemblyidentity name="Microsoft.Xrm.Sdk" publickeytoken="31bf3856ad364e35" culture="neutral"></assemblyidentity>
    <bindingredirect oldversion="0.0.0.0-8.0.0.0" newversion="8.0.0.0"></bindingredirect>
</dependentassembly>

Have compared to Dev where the v5 DLLs are in the IdB Service folder and it's working. Same version of CRM in both environments.

I added that to the Unify.Service.Connect.exe.config file - however I still can't start IdB, with the same error as above.

BTW the version of the new DLLS is 8.2.0.713

I have the same version SDK and was able to get it working with the config update.


The config you added to is the service config. Are you running IdB via the service or with the debug exe in the services directory? They have different config files.


This is my config. Does yours look similar?


Identical. The service will not start with the v8 dlls in there, and will only start with the v5 dlls in there.

BTW when you tested this did you have a CRM agent configured? The service will start if I remove all traces of CRM from the config files - but that's not much help.

Answer
Answered

Issue was resolved with packaged CRM SDK replaced with version 8.2 and the above binding redirect configuration. Issues with the binding redirect configuration were caused by Voice lower-casing all XML element and attribute names. Refer to above image for correct casing.

In addition I believe the updated CRM SDK DLLs may have been needed in the first place because the CRM port was changed from the default value of 5555 to 443.