Skip to main content
Dynamics 365
  • 4 min read

“Maximum number of items that can be serialized or deserialized in an object graph is ‘65535’.” In Dynamics AX 2012


If you receive an error message like:

Maximum number of items that can be serialized or deserialized in an object graph is ‘65535’.

And the Article:

https://technet.microsoft.com/en-us/library/gg862502.aspx

Is not fixing the issue for you. Please use the following steps:

PART 1

https://technet.microsoft.com/en-us/library/gg862502.aspx

Ax32serv.exe.config need to be updated in your system to match the below as from the article above.

1) Update the ServiceBehavior MetadataServiceBehavior to increase the maxItemsInObjectGraph, by adding the dataContractSerializer object.

        <behavior name=”MetadataServiceBehavior”>

          <dataContractSerializer maxItemsInObjectGraph=”524288″ />

          <serviceMetadata httpGetEnabled=”true” httpGetUrl=”http://DAX2012.contoso.com:8101

                                  /DynamicsAx/Services/MetadataService” />

          <serviceDebug includeExceptionDetailInFaults=”False” />

          <serviceThrottling maxConcurrentCalls=”200″ maxConcurrentSessions=”200″

                                   maxConcurrentInstances=”200″ /<useRequestHeadersForMetadataAddress>

            <defaultPorts>

              <add scheme=”net.tcp” port=”8201″ />

            </defaultPorts>

          </useRequestHeadersForMetadataAddress>

        </behavior>

2) Create an Endpoint Behavior that also increases the maxItemInObjectGraph

      <endpointBehaviors>

        <behavior name=”MetadataEndpointBehavior”>

          <dataContractSerializer maxItemsInObjectGraph=”524288″ />

        </behavior>

      </endpointBehaviors>

 

3) Update the MetadataService Endpoint to use the new Endpoint Behavior by adding a behaviorConfiguration attribute on the endpoint

<service behaviorConfiguration=”MetadataServiceBehavior”

                           name=”Microsoft.Dynamics.AX.Framework.Services.Metadata.Service.AxMetadataService”>

        <endpoint address=”net.tcp://DAX2012.contoso.com:8201/DynamicsAx/Services/MetadataService”

                           behaviorConfiguration=”MetadataEndpointBehaviour”

                           binding=”netTcpBinding” bindingConfiguration=”MetadataServiceBinding”

                           name=”MetadataServiceEndpoint”

                          contract=”Microsoft.Dynamics.AX.Framework.Services.Metadata.Service.IAxMetadataService” /

</service>

PART 2

The AX client configuration will need to be updated to include the dataContractSerializer object as part of an endpoint behavior.

  1. Make any of the above changes that are not present and restart the AOS after saving the changes
  2. Open the Client configuration utility on the SSRS server
  3. Change the config target from Local Client to Non-Interactive
Microsoft Dynamics AX Configuration Utility.
  1. Click the Refresh button to load the most recent configuration
Microsoft Dynamics AX Configuration Utility after clicking the refresh button to load the most recent configuration.
  1. Click the Configure Services button as you now need to add the endpoint behavior
Microsoft Dynamics AX Configuration Utility after clicking the configure services button.
  1. In the configuration tool, to Advanced > Endpoint Behaviors
  2. Click the link for ‘New Endpoint Behavior Configuration
  3. Change the Name of the behavior to MetadataEndpointBehavior
  4. Click the Add button, select the dataContractSerializer extension and click Add Again
        Data contract serializer extension.
        1. Double click on the dataContractSerializer element that was added
        2. Change the MaxItemsInObjectGraph value from 65536 to match the value used in the Ax32Serv.exe (example 524288)
        Data contract serializer.
        1. In the configuration tool, to to Advanced > ServiceBehaviors
        2. Click the link for ‘New ServiceBehavior Configuration
        3. Change the Name of the behavior to MetadataServiceBehavior
        4. Click the Add button, select the dataContractSerializer extension and click Add Again
        Metadata service behavior.
        1. Double click on the dataContractSerializer element that was added
        2. Change the MaxItemsInObjectGraph value from 65536 to match the value used in the Ax32Serv.exe (example 524288)
        Data contract serializer.
        1. Now go up to Client > Endpoints and select the MetadataServiceEndpoint.
        2. Set the BehaviorConfiguration property for the endpoint to your MetadataEndpointBehavior (it should show up in the drop down to be selected)
        Client endpoint configuration.
        1. File > Save to save your configuration changes, then close the WCF configuration editor
        2. Back in the AX client configuration utility click Apply to save the changes
        3. Restart the SSRS service
        4. Run the report and it should now work

        Note

        Manually changing the config on the SSRS server means if any services are reconfigured it will not automatically pick up those changes.  Any changes made server side (through Ax32Serv.exe or through Inbound Ports form) will have to be updated in the config manually on this machine, or they can click Refresh to get the latest config and then recreate the endpoint behavior.  Given Visual Studio doesn’t pick this up either, it seems typical that an application will not inherit endpoint behaviors from a service.  Ideally you would just get your customizations to a point that the defaults do not need to be overridden.

        Related to this Note and Part 2  please note that there is a possibility to configure a separate AXC file for SSRS BC use only.

        Please see

        https://technet.microsoft.com/EN-US/library/hh389774.aspx

         

        Notice:

        “Microsoft provides programming
        examples for illustration only, without warranty expressed or implied,
        including, but not limited to, the implied warranties of merchantability or
        fitness for a particular purpose. This mail message assumes that you are
        familiar with the programming language that is being demonstrated and the tools
        that are used to create and debug procedures.”

        This is not an officially tested solution by
        Microsoft and should be fully tested before implementation.

         

        Writer: Uwe Zimmermann <uwezim@microsoft.com>

         

         

        Get started with Dynamics 365

        Drive more efficiency, reduce costs, and create a hyperconnected business that links people, data, and processes across your organization—enabling every team to quickly adapt and innovate.