views:

3121

answers:

4

Hi there,

When I pass a list of objects out of my silverlight app using WCF everything works fine until the List grows too big. It seems that when I exceed 80 items I get the error: The remote server returned an unexpected response: (404) Not Found

I'm presuming that it's because the List has grown too big as when the List had 70 items everyhing works fine. Strange error message though, right?

In the config file I change the maxBufferSize to the highest value that it will accept but still I can't have more then 80 items in my List.

How can I pass out large objects without having to split the object up?

+2  A: 

There are two config files. The silverlight clientconfig will let you send the larger message, but if you'r eusing WCF, there is a server web.config that limits the size of the received message (to prevent DDOS attacks).

Shawn Wildermuth
Hi Shawn, any advice on my comment below?
+1  A: 

Thanks Shawn, so where exactly do I do it? This is my ServiceReferences.ClientConfig

<configuration>
<system.serviceModel>
    <client>
      <!--"http://sy01911.fw.gsjbw.com/WcfService1/Service1.svc"--&gt;
      <endpoint address="http://localhost/WcfService1/Service1.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService11"
            contract="SilverlightApplication1.ServiceReference1.IService1"
            name="BasicHttpBinding_IService1" />
    </client>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService1" maxBufferSize="655360000"
                maxReceivedMessageSize="655360000">
                <security mode="None" />
            </binding>
            <binding name="BasicHttpBinding_IService11" maxBufferSize="655360000"
                maxReceivedMessageSize="655360000">
                <security mode="None" />
            </binding>
        </basicHttpBinding>
    </bindings>
</system.serviceModel>


and this is the server config that you mentioned


<services>
  <service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior" >
    <!-- Service Endpoints -->
    <endpoint address="" binding="basicHttpBinding" contract="WcfService1.IService1" >
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="WcfService1.Service1Behavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

A: 

In server side, change the config file to make the service can accept large message. 1. Add a basicHttpBinding configuration in section: .......

  1. Add the configuration to the service binding.
A: 

If you are sending out a large number of items from WCF, also make sure that maxItemsInObjectGraph is a relatively high number

<behaviors>
   <serviceBehaviors>
      <behavior name="YourBahvior">
         <dataContractSerializer maxItemsInObjectGraph="6553600"/>
      </behavior>
   </serviceBehaviors>
</behaviors>
Jacob Adams