Silverlight & WCF: Max message size

前端 未结 3 998
刺人心
刺人心 2021-01-13 15:37

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: T

相关标签:
3条回答
  • 2021-01-13 16:15

    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).

    0 讨论(0)
  • 2021-01-13 16:23

    In server side, change the config file to make the service can accept large message.

    1. Add a basicHttpBinding configuration in <system.serviceModel> section:

      <?xml version="1.0" encoding="utf-8" ?>
      <configuration>
          <system.serviceModel>
             <bindings>
               <basicHttpBinding>
                  <binding name="MyBasicHttpBinding" maxReceivedMessageSize="300000000">
                     <security mode="None"/>
                     <readerQuotas maxStringContentLength="300000000"/>
                  </binding>
               </basicHttpBinding>
             </bindings>
      .......
      
    2. Add the configuration to the service binding.

      <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding" contract="WcfService1.IService1">
      
    0 讨论(0)
  • 2021-01-13 16:36

    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>
    
    0 讨论(0)
提交回复
热议问题