views:

1333

answers:

4

I'm trying to call a WCF service (hosted in a Windows Service, not IIS) and am getting the following error:

The maximum message size quota for incoming messages has been exceeded for the remote channel. See the server logs for more details.

I have tried increasing the MaxReceivedMessageSize and the ReaderQuotas to their maximum values without any luck.

I have also turned on logging and checked the messsage size that's getting "sent." It's definitely nowhere near the maximum. We're talking about sending an object that serialized into 372KB XML.

Two questions:

  1. Does anyone know what "server logs" the message is referring to? I've checked the EventViewer but nothing shows up there...

  2. Does anyone know what other configuration setting(s) might apply here?

+1  A: 

I think server logs means the tracing and logging files which are created when you turn that on. Here's the MSDN link.

The properties which I run into with WCF that need to have a higher value in the applications I write are maxReceivedMessageSize, maxStringContentLength, maxArrayLength and maxBufferSize. Try to increase them and see what happens. WCF can be a pain to debug as it is fond to swallow exceptions.

BennyM
+2  A: 

Your question reminded me of a blog post by Shawn Wildermuth where he was having trouble with Large Message Sizes in a Silverlight application. Perhaps this will help you out:

http://wildermuth.com/2009/09/10/Using%5FLarge%5FMessage%5FRequests%5Fin%5FSilverlight%5Fwith%5FWCF

Shawn says:

The trick is to change the customBinding in the web.config to use larger defaults. I picked 2MB as it its a reasonable size. Of course setting them to 2GB like shown above will work but it does leave you more vulnerable to attacks. Pick a size that isn't larger than your largest request but isn't overly large. Its a guessing game. To set these, you need to add them to your web.config is to put them on the httpTransport node:

Ben McCormack
Thanks! This article was really helpful.
manu08
+1  A: 

You can specify the server logs and path in the application config 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>
simon_bellis
I have added this config item to my service application and am getting the log file. However, it simply shows sending the message that blows up. It doesn't show anything about the actual error or antyhing else at all.
manu08
A: 

Two things:

  • can you show us the server and client side config (just the relevant sections - endpoints, binding configuration)

  • did you change the values on both sides (client and server)??

There's a whole plethora of size settings you can influence....

marc_s