I have an application that uploads large files using WCF using netTcpBinding. For a specific file, I get an error message:
Exceeded maximum message size quota for incoming messages (65536). To increase the quota, use the MaxReceivedMessageSize property in the corresponding binding element.
Here is my binding to the web.config client file (client - 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 that I also needed to change the maxReceivedMessageSize property to configure the service. So I added this binding:
<bindings> <netTcpBinding> <binding name="NetTcpLarge" maxReceivedMessageSize="5242880" maxBufferSize="5242880"> <readerQuotas maxStringContentLength="524288"/> </binding> </netTcpBinding> </bindings>
and changed my endpoint:
<endpoint address="DataImportService" binding="netTcpBinding" name="DataImportEndpoint" bindingConfiguration="NetTcpLarge" contract="IDataImportService" />
This fixed the problem when I run a standalone installation in Visual Studio. But in the instance running on IIS 7, I still get the same error as 65536. Am I missing something? I even added this to my service configuration on an IIS 7 instance, but to no avail:
<system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="5242880" /> </requestFiltering> </security> </system.webServer>
source share