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>