Skip to main content
Published: February 27 2009, 5:35:00 PMUpdated: November 28 2020, 5:18:48 PM

I am making SOAP calls with .NET for LMS. My downloadFile call is failing with Maximum message size quota for incoming messages (65536) has been exceeded error.

 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.

     --- End of inner exception stack trace ---

     Server stack trace:

     at System.ServiceModel.Channels.MessageEncoder.BufferMessageStream(Stream stream, BufferManager bufferManager, Int32 maxBufferSize)
     at System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, BufferManager bufferManager, Int32 maxBufferSize, String contentType)
     at System.ServiceModel.Channels.HttpInput.ReadChunkedBufferedMessage(Stream inputStream)
     at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)
     at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
     at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
     at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)     

Cause:

You are getting the error because the total number of bytes that the service is attempting to return exceeds the configuration values (the default is 65536). This is because the size of the payload being returned is huge.

Resolution:

In order to overcome this error you will need to raise the total number of bytes that can be returned, the following changes are required:

Open the app.config file in the project and change the following values in the binding element for the FileTransferService (<binding name="FileTransferServiceSOAPBinding">)

maxBufferSize=”2147483647?
maxReceivedMessageSize=”2147483647?

Note that the values being configured above are the maximums possible.

How well did this answer your question?
Answers others found helpful