tags:

views:

63

answers:

2

Hi folks,

from my Silverlight 3 application, I consume a WCF-service. I pass a list of integers to the service. This list can get quite large >10k entries. Eventually, I get an error from the service, when the list is getting to big.

I know, I can set the value to allow more data to be transfered in the ServiceReference.ClientConfig file, but I don't know where and which property to set.

As the configuration is done in the server, I now display the server configuration:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<appSettings>
     ...
</appSettings>

<system.web>
<compilation debug="true" />
 <httpRuntime maxRequestLength="1048576"
        executionTimeout="200" />
</system.web>
<system.serviceModel>
<extensions>
  <behaviorExtensions>
    <add name="silverlightFaults" type="DiscoDataSource.SilverlightFaultBehavior, DiscoDataSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  </behaviorExtensions>
</extensions>
<bindings>
  <basicHttpBinding>
   <binding name="MyBinding" closeTimeout="10:00:00" openTimeout="10:00:00"
      receiveTimeout="10:00:00" sendTimeout="10:00:00" maxBufferSize="6553600"
      maxBufferPoolSize="6553600" maxReceivedMessageSize="6553600" >
    <readerQuotas maxArrayLength="2147483647"/>
   </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="DiscoDataSource.Service1Behavior"
    name="DiscoDataSource.Service1">
    <endpoint address="" behaviorConfiguration="DiscoBehavior" binding="basicHttpBinding"
      bindingConfiguration="MyBinding" name="standardEndPoint" contract="DiscoDataSource.IService1">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8731/Design_Time_Addresses/DiscoDataSource/Service1/" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="DiscoBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483646" />
    <silverlightFaults />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="DiscoDataSource.Service1Behavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="True" />
    </behavior>
  </serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

EDIT: I have experimented with the size of the list I send (it is a Dictionary with object always null). After 60k elements (~0.5 MB), the error occurs. What REALLY bothers me is, that the error is the infamous NotFound-Error - although I changed error-reporting behavior (which works for exceptions that are thrown by the code of the service)

I already added the answers of bnkdev and marc_s, but unfortunately there seems to be another barrier.

Can anyone help me out?

Thanks in advance, Frank

+1  A: 

Since you're using http it might be worthwhile to look at the maxRequestLength of the httpRuntime, for e.g.

<httpRuntime maxRequestLength="2097151"/>
RandomNoob
I included your tip in the services App.config (as updated above), but it doesn't resolve the problem.
Aaginor
A: 

There's also an additional parameter maxArrayLength in the <ReaderQuotas> which determines the maximum number of elements in an array - this defaults to 8192.

<bindings>
    <basicHttpBinding>
        <binding name="standardBindingPoint" closeTimeout="10:00:00"
            openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00"
            maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
            <readerQuotas maxArrayLength="15000"/>
            <security mode="None" />
        </binding>
    </basicHttpBinding>
</bindings>

Increase that to more than its default, big enough to hold your largest list of ints.

marc_s
I included your tip in the services App.config (as updated above), but it doesn't resolve the problem.
Aaginor