Maximum message size for WCF

I try to call the WCF service (hosted on a Windows service, not IIS) and I get the following error:

Maximum message size quota for exceeded incoming messages for a remote channel. See server logs for more details.

I tried to increase MaxReceivedMessageSize and ReaderQuotas to their maximum values ​​with no luck.

I also turned on logging and checked the size of the messsage that gets sent. It is definitely nowhere near the maximum. We are talking about transferring an object that is serialized to 372 KB XML.

Two questions:

  • Does anyone know what the "server logs" referenced by the message are? I checked EventViewer but nothing appears there ...

  • Does anyone know what other configuration options might apply here?

+7
c # wcf wcf-binding channel
source share
4 answers

Your question reminded me of a Shawn Wildermuth blog post where he had problems with large message sizes in a Silverlight application. Perhaps this will help you:

http://wildermuth.com/2009/09/10/Using_Large_Message_Requests_in_Silverlight_with_WCF

Sean says:

The trick is to change customBinding in web.config to use large defaults. I chose 2 MB as it is its reasonable size. Of course, setting them to 2 GB as shown above will work, but that makes you more vulnerable to attacks. Choose a size that does not exceed your largest request, but not too large. This is a guessing game. To install them, you need to add them to your web.config to put them in the httpTransport node:

+5
source share

I think server logs mean trace and log files that are created when you turn it on. Here is the MSDN link.

The properties I encounter with WCF, which should have a higher value in the applications I write, are maxReceivedMessageSize, maxStringContentLength, maxArrayLength and maxBufferSize. Try to enlarge them and see what happens. WCF can be painful to debug because it likes to swallow exceptions.

+1
source share

You can specify the logs and server path in the application configuration as follows

<system.diagnostics> <trace autoflush="true" /> <sources> <source name="System.ServiceModel" switchValue="Critical, Error, Warning" > <listeners> <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="F:\log-data\ServiceTrace.svclog" /> </listeners> </source> </sources> </system.diagnostics> 
+1
source share

Two things:

  • You can show us the server and client configuration (only relevant sections - endpoints, binding configuration)

  • Have you changed the values ​​on both sides (client and server)?

There are many size settings that you can influence.

0
source share

All Articles