Posts Tagged ‘AX 2012’

There are lots of example of creating a new custom services in ax 2012. So I am not going to repeat that here again but give you some idea that I have met during development of custom service which handles large dataset.

Symptom #1:

“There was an error while trying to serialize parameter http://tempuri.org:response. The InnerException message was ‘Maximum number of items that can be serialized or deserialized in an object graph is ‘65536’. Chang the object graph or increase the MaxItemsInObjectGraph quota.’. Please see InnerException for more details.”

Solution:

1. Add below in your config file. blank behavior name should apply for all services, including the one created by WCF RIA Services.

<behaviors>

<serviceBehaviors>

<behavior name=“”>

<serviceMetadata httpGetEnabled=”true”/>

<serviceAuthorization impersonateCallerForAllOperations=”false”/>

<dataContractSerializer maxItemsInObjectGraph=”2147483647″/>

</behavior>

</serviceBehaviors>

</behaviors>

Or

2. Increase the maxItemsInObjectGraph quota value from server side.

    1. Open System administration > Setup > Services and AIF > Inbound ports
    2. Select [your service] and deactivate if needed
    3. Open ‘Configure’ of adapter
    4. Create dataContractSerializer element in service behaviors and increase the value of MaxReceivedMessageSize to 2G.
             

Symtom #2:

“The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.”

Cause:

while net.tcp binding is used for this service, other properties also need to be increased.

Solution:

Increase values in <ReaderQuotas> tag.

<system.serviceModel>

<bindings>

<netTcpBinding>

<binding …… maxReceivedMessageSize=”2147483647″>

<readerQuotas maxDepth=”32″ maxStringContentLength=”2147483647″ maxArrayLength=”2147483647″ maxBytesPerRead=”2147483647″ maxNameTableCharCount=”2147483647″ />

</binding>

</netTcpBinding>

</bindings>

</system.serviceModel>