Home

Nov 29, 2010

The maximum message size quota for incoming messages (65536) has been exceeded.

I got above error while retrieving user data from CRM.

This error occurred when we try to retrieve data which is more than default size of the XML message, here it is (65536).

You can increase the default XML message size by using below code:

//Create a new binding element from the endpoint's binding so that certain properties can be changed generically
XrmBinding newBinding = new XrmBinding(endpoint.Binding);
endpoint.Binding = newBinding;

//Set the required properties
newBinding.MaxReceivedMessageSize = 1024 * 1024 * 10; //10 MB
newBinding.MaxBufferSize = 1024 * 1024 * 10; //10 MB

//Set the properties on the reader quotas
newBinding.ReaderQuotas.MaxStringContentLength = 10 * 1024 * 1024; //10 MB
newBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
newBinding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;



-Amol

 

 

No comments: