While trying to upload files that are bigger than 64 KB, we came across this error: 413 Request Entity Too Large.
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.
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.
As the error above mentions, this issue occurs because the request size is bigger than the MaxReceivedMessageSize
for WCF.
Increase MaxReceivedMessageSize
value for your web service to solve this issue. However, this may get tricky because there are two different MaxReceivedMessageSize
parameters:
This configuration below will increase the MaxReceivedMessageSize
in System.ServiceModel.Configuration.BasicHttpBindingElement
<basicHttpBinding>
<binding name="basicHttpBinding_Portal" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
You should increase the MaxReceivedMessageSize
in System.ServiceModel.Channels.HttpTransportBindingElement as well:
<customBinding>
<binding closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00">
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" useDefaultWebProxy="true" transferMode="Buffered" />
</binding>
</customBinding>
You can also do it in the code as explained in this document.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.