WCF:The maximum string content length quota (8192) has been exceeded while reading XML data

修改接收端的WCF config文件,注意,如果server端接收request超长,则修改server端config,如果是client 接收response超长,则修改client端,建议两边都修改,保持一致

<bindings>
      <wsHttpBinding>
        <binding name="NewBinding2" maxReceivedMessageSize="67108864">
      <readerQuotas maxStringContentLength="67108864"/>
          <security mode="None" />
        </binding>
      </wsHttpBinding>
    </bindings>

 

<service behaviorConfiguration="DomainWS.DomainServiceV2Behavior"
      name="DomainWS.DomainServiceV2">
       <endpoint address="" binding="wsHttpBinding" bindingConfiguration="NewBinding2" contract="DomainWS.IDomainV2">
         <identity>
           <dns value="localhost" />
         </identity>
       </endpoint>
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
     </service>
   </services>

 

Note:

MaxStringContentLength

The maximum string length returned by the reader. The default is 8192.

你可能感兴趣的:(content)