Exceeded maximum message size quota for incoming messages (obvious fix doesn't help)

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> 
+6
source share
2 answers

If the exception still matches IIS, it has nothing to do with <requestLimits> , the exception explicitly indicates that maxReceivedMessageSize exceeded. I would capture WCF traces at a detailed level and check which configuration binding is applied to the endpoint.

I would advise you to double-check the configuration of the client and service and, if there is still no prompt, track the traces for the service and client at a detailed level.

+6
source

It looks like you can exceed the IIS buffer size "maxRequestLength". The default size ... you assumed 65536. Try adding the following lines to the web.config file:

 <system.web> <compilation debug="true"/> <httpRuntime maxRequestLength="5242880"/> </system.web> 
0
source

Source: https://habr.com/ru/post/885579/


All Articles