Avalara Tax Connector - Troubleshooting - Error - Maximum Message Size Quota For Incoming Messages Has Been Exceeded

Avalara Tax Connector - Troubleshooting - Error - Maximum Message Size Quota For Incoming Messages Has Been Exceeded

Issue

You may receive the following message after running the Tax macro on an order with a lot of lines:
"'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.' At Line 0 Position 0"



This only occurs when clicking on the macro.

Steps to Recreate:
Save an Order and click Order Total with Tax

Expected Results:
Instead of showing the error box it should show the box which displays the order total and the expected tax.

Business Impact:
It seems that the connector tool is working it is just not displaying the tax for the order when this error pops up. it also seems to occur on orders that have a larger number of lines on them.


Resolution

There are (2) two possible resolutions.  
1)  Modify the Order Total with Tax macro.

One can choose to use either of the following line mods:
  1. util.MaxReceivedMessageSize = CDbl(util.MaxReceivedMessageSize)*10
  2. util.MaxReceivedMessageSize = CDbl(2147483775)    REM  This field is a long (64 bit) so it can be as large as  9,223,372,036,854,775,807 
What does this do?  When the url connection is created (see ServerURL = "your api url", prior to connection to the service, this sets the endpoint binding MaxReceivedMessageSize for all incoming messages when communicating to the url.

2) Go to the customers SRITaxServer  installation. 
Open the web.config file
In the <bindings> section of the web.config files needs the following bolded modifications;  alongside whatever might already be there:
  1. <bindings>
  2.     <basicHttpBinding>
  3.        <!-- maxReceivedMessageSize="2147483775maxBufferSize="2147483775"  -->
  4.         <binding name="basicHttp" allowCookies="true"
  5.                  maxReceivedMessageSize="20000000" 
  6.                  maxBufferSize="20000000"
  7.                  maxBufferPoolSize="20000000">
  8.             <readerQuotas maxDepth="32" 
  9.                      maxArrayLength="200000000"
  10.                      maxStringContentLength="200000000"/>
  11.         </binding>
  12.     </basicHttpBinding>
  13. </bindings>
Also verify that the binding name is in the endpoint configuration.
  1. <client>
  2.     <endpoint ... bindingConfiguration="basicHttp" />
  3. </client>

Notes
Notes:
  1. "basicHttp" in this example is the name of the already-existing binding in the web.config. There should already be an existing binding in there--use that name.
  2. 200 million was chosen arbitrarily as a number greater than 65536. The drawbacks of having a larger limit is that there is more vulnerability to a DDOS attack, so that number can be adjusted as needed.