Keithin8a
Keithin8a

Reputation: 961

Error message why unit testing AIF: Maximum message size quota for incoming messages has been exceeded

Sorry for the long title.

I am writing a Unit Test framework for Dynamics AX in C# to test an integration project we are working on using the Dynamics Connector.

The basic structure of our timesheet tests is:

  1. Create snapshot of database (AX doesn't allow mock objects)
  2. Log onto an AX instance, create Basic Data such as customer, project etc... Logoff
  3. Create the timesheet item for the test
  4. Post the timesheet using a call to the document service
  5. Retrieve the timesheet
  6. Assert

On some tests we are experiencing an error message on point 5 which is saying

System.ServiceModel.CommunicationException: 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. ---> System.ServiceModel.QuotaExceededException: 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.

I have split the message up into two as it sounds like two different errors

TestCleanup method ... threw exception. System.ServiceModel.CommunicationObjectFaultedException: System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state

With us using the AIF I can't do the top part because the binding xml is nowhere to be seen (as far as we know)

The strange thing is, this error doesnt seem to come consitently but we are cleaining up everything that we can see on the test.

Can anyone help me? Even if it is just suggesting things to try.

Another thing to note is that these errors quite often cause the dynamics ax service to crash which makes debugging it a complete pain in the backside

Upvotes: 1

Views: 2611

Answers (1)

Matej
Matej

Reputation: 7627

Change the configuration of the AIF port. You have to change the maxReceivedMessageSize for the binding.

Example:

<configuration>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="DefaultServiceGroupBinding" 
            maxReceivedMessageSize="104857600" 
            ...
        />
      </netTcpBinding>
    </bindings>
    ...
<configuration>

AIF WCF Binding Configuration

Upvotes: 3

Related Questions