Wcf-The maximum message size quota for incoming messages (65536) has been exceeded?

前端 未结 1 1462
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 15:35

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding ele

相关标签:
1条回答
  • 2020-11-28 16:32

    You should set maxReceivedMessageSize="2147483647" to increase message size. Try to change config to this:

    <binding maxBufferSize="2147483647" 
             maxBufferPoolSize="2147483647" 
             maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" 
                      maxStringContentLength="2147483647" 
                      maxArrayLength="2147483647" 
                      maxBytesPerRead="2147483647"
                      maxNameTableCharCount="2147483647" />
    </binding>
    

    But it is a bad practice to increase you message values to max value. This can lead you to serious troubles with DOS leaks.

    UPDATED:

    <system.serviceModel>
      <bindings>
       <wsHttpBinding>
        <binding name="wsBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"  >
          <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
        </binding>
       </wsHttpBinding> 
      </bindings>
      <services>
      <service name="FileService.Service1" behaviorConfiguration="FileService.Service1Behavior">
      <host>
        <baseAddresses>
          <add baseAddress = "http://localhost:8732/Design_Time_Addresses/FileService/Service1/" />
        </baseAddresses>
      </host>
       <endpoint address ="" binding="wsHttpBinding" bindingConfiguration="wsBinding" contract="FileService.IService1">   
       <identity>
        <dns value="localhost"/>
       </identity>
     </endpoint>
    
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
     </service>
     </services>
     <behaviors>
       <serviceBehaviors>
         <behavior name="FileService.Service1Behavior">    
           <serviceMetadata httpGetEnabled="True"/>    
           <serviceDebug includeExceptionDetailInFaults="False" />
         </behavior>
       </serviceBehaviors>
     </behaviors>
    </system.serviceModel>
    
    0 讨论(0)
提交回复
热议问题