5

I want to send a big XML string to a WCF SVC service from Silverlight.

It looks like anything under about 50k is sent correctly but if I try to send something over that limit, my request reaches the server (BeginRequest is called) but never reaches my SVC. I get the classic "NotFound" exception.

Any idea on how to raise that limit?

If I can't raise it? What are my other options?

Here's my binding configuration

<bindings>
        <customBinding>
            <binding name="customBinding0" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
                <binaryMessageEncoding>
        <readerQuotas
            maxArrayLength="2147483647"
            maxBytesPerRead="2147483647"
            maxDepth="2147483647"
            maxNameTableCharCount="2147483647"
            maxStringContentLength="2147483647" />

      </binaryMessageEncoding>
                <httpTransport/>
            </binding>
            <binding name="customBindingSecure" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
                <binaryMessageEncoding>
        <readerQuotas
            maxArrayLength="2147483647"
            maxBytesPerRead="2147483647"
            maxDepth="2147483647"
            maxNameTableCharCount="2147483647"
            maxStringContentLength="2147483647" />
                </binaryMessageEncoding>
                <httpsTransport/>
            </binding>
        </customBinding>
    </bindings>

Edit: More details : If I break in the Global.asax Endrequest, I see in the Response "Bad Request 400"

Edit: More details again : I activated the Trace and I can see the following error : 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.

However, my maxReceivedMessageProperty is already set to 2147483647.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
2d1b
  • 595
  • 1
  • 6
  • 24

3 Answers3

6

Ok got it working!

Since I am using a customBinding, the maxReceivedMessageSize has to be set on the httpTransport element like this :

<bindings>
        <customBinding>
            <binding name="customBinding0" >
                <binaryMessageEncoding>
        <readerQuotas
            maxArrayLength="2147483647"
            maxBytesPerRead="2147483647"
            maxDepth="2147483647"
            maxNameTableCharCount="2147483647"
            maxStringContentLength="2147483647" />

      </binaryMessageEncoding>
                <httpTransport maxReceivedMessageSize="4194304" />
            </binding>
            <binding name="customBindingSecure">
                <binaryMessageEncoding>
        <readerQuotas
            maxArrayLength="2147483647"
            maxBytesPerRead="2147483647"
            maxDepth="2147483647"
            maxNameTableCharCount="2147483647"
            maxStringContentLength="2147483647" />
                </binaryMessageEncoding>
                <httpsTransport  maxReceivedMessageSize="4194304" />
            </binding>
        </customBinding>
    </bindings>

Thank you all for your help!

2d1b
  • 595
  • 1
  • 6
  • 24
1

You can also turn on WCF logging for more information about the original error. This helped me solve this problem.

Add the following to your web.config, it saves the log to C:\log\Traces.svclog

<system.diagnostics>
    <sources>
        <source name="System.ServiceModel"
                  switchValue="Information, ActivityTracing"
                  propagateActivity="true">
            <listeners>
                <add name="traceListener"
                     type="System.Diagnostics.XmlWriterTraceListener"
                     initializeData= "c:\log\Traces.svclog" />
            </listeners>
        </source>
    </sources>
</system.diagnostics>
Aaron Hoffman
  • 6,604
  • 8
  • 56
  • 61
0

Try this in the app.config/web.config on the server side:

<system.web>
    <httpRuntime maxRequestLength="109200" executionTimeout="3600" />
</system.web>
Bob Manz
  • 106
  • 2
  • 8