Search code examples
silverlightwcf-ria-services

Limit of wcf ria service count to silverlight


Is there a limit to the number of elements you can send from wcf ria service to a silverlight client?

For some reason, no elements are seen in the callback on the silverlight client when the number of elements sent from the service exceeds 3450.


Solution

  • There can be limitations in config file, connected to MaxRecivedMessageSize (default maximum is 2 147 483 647 bytes, if I'm not wrong). Also there is default limitation for maximum items in returned object graph(the value is 65536). It means that if 3450 entities with too much dependencies and related objects that are also passed to client - you'll get an error. For fixing this, for your own risk add behavior configuration for service:

    ...
      <services>
        <service name="MySilverlightAppl.Web.MyDomainService" behaviorConfiguration="MyDomainServiceConfig">
        </service>
      </services>
    
      <behaviors>
        <serviceBehaviors>
           <behavior name="MyDomainServiceConfig">
             <dataContractSerializer maxItemsInObjectGraph="xxxxxx"/>
           </behavior>
        </serviceBehaviors>
      </behaviors>
    </system.serviceModel>