Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The maximum message size quota for incoming messages has been exceeded (obvious fix not helping)

I have an application which is uploading large files using WCF with netTcpBinding. For a particular file, i'm getting the error message:

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.

Here is my binding on the client web.config file (client is an ASP.NET website):

    <binding name="DataImportEndpoint" closeTimeout="00:20:00" openTimeout="00:01:00"
      receiveTimeout="00:20:00" sendTimeout="00:20:00" transferMode="Buffered"
      hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
      maxBufferSize="5242880" maxReceivedMessageSize="5242880">
      <readerQuotas maxDepth="32" maxStringContentLength="524288" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="Transport">
        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
      </security>
    </binding>

I realized I also needed to change the maxReceivedMessageSize property for the service config. So i added this binding:

<bindings>
  <netTcpBinding>
    <binding name="NetTcpLarge"
             maxReceivedMessageSize="5242880" maxBufferSize="5242880">
      <readerQuotas maxStringContentLength="524288"/>
    </binding>
  </netTcpBinding>
</bindings>

and modified my endpoint:

<endpoint address="DataImportService" binding="netTcpBinding"
       name="DataImportEndpoint" bindingConfiguration="NetTcpLarge"
       contract="IDataImportService" />

This fixed the problem when i run self hosted in Visual Studio. But on an instance running on IIS 7, i'm still getting the same error that 65536 has been exceeded. Am i missing something here? i even added this to my service config in IIS 7 instance, but to no avail:

<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="5242880" />
        </requestFiltering>
    </security>
</system.webServer>
like image 465
pjacko Avatar asked Apr 09 '11 21:04

pjacko


1 Answers

If the exception is still same with IIS, it has nothing to do with <requestLimits>, the exception clearly indicates that maxReceivedMessageSize is exceeded. I'd capture the WCF traces at verbose level and check what binding configuration is applied on endpoint.

I'd suggest you to recheck the client and service configuration and if still no clue, capture traces for service and client at verbose level.

like image 169
amit Avatar answered Sep 22 '22 12:09

amit