none
通过WCF保存超大量数据时报错The maximum string content length quota (8192) has been exceeded RRS feed

  • 问题

  • 数据库中有一个字段是用来存放超大文本的,我手动在数据库里插了一个数据,通过WCF读取,Silverlight能正常读取并显示,可当我想修改部分内容再保存时,就报这个错误The maximum string content length quota (8192) has been exceeded 。

    网上能找的解决方案都试了还是不行!

    我的WCF web.config是这样的

    <?xml version="1.0"?>
    <configuration>
     <system.web>
      <compilation debug="true" targetFramework="4.0"/>
     </system.web>
     <system.serviceModel>
    
      <bindings>
       <basicHttpBinding>
        <binding name="LargeDataTransferServicesBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
         <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
         <security mode="None" />
        </binding>
       </basicHttpBinding>
      </bindings>
    
      <services>
       <service name="BSC.DMP.DMPService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeDataTransferServicesBinding" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
       </service>
      </services>
    
      <behaviors>
       <serviceBehaviors>
        <behavior>
         <!-- 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"/>
         <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
       </serviceBehaviors>
      </behaviors>
    
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    
     </system.serviceModel>
     <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
      <directoryBrowse enabled="true"/>
     </system.webServer>
    </configuration>
    
    
    2010年7月13日 7:53

答案

  • 客户端的配置中binding也要一样:

    <binding name="LargeDataTransferServicesBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
         <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
         <security mode="None" />
        </binding>

    • 已标记为答案 Mog Liang 2010年7月21日 2:45
    2010年7月13日 9:04