maxReceivedMessageSize WCF

1.8k views Asked by At

I consume a WCF service, but I have a problem

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

I have modified MaxReceivedMessageSize, but there is no result (I read many articles in the internet, but anyone can't help)

Who knows about this?

Service.config:

<system.serviceModel>       
   <bindings>           
      <wsHttpBinding>
         <binding name="BindingWithMaxSizeIncreased" 
                  maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
            <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                          maxArrayLength="2147483647" maxBytesPerRead="2147483647" 
                          maxNameTableCharCount="2147483647" />
         </binding>             
      </wsHttpBinding>      
   </bindings>      
   <services>           
      <service name="FootballLife.MyService" behaviorConfiguration="metadataBehavior">
         <endpoint 
             address="" 
             binding="wsHttpBinding" bindingConfiguration="BindingWithMaxSizeIncreased" 
             contract="FootballLife.IMyService">
            <identity>
               <dns value="localhost"/>
            </identity>
         </endpoint>
         <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>        
   </services>      
   <behaviors>          
      <serviceBehaviors>
         <behavior name="metadataBehavior">
            <serviceMetadata httpGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="false"/>
         </behavior>            
      </serviceBehaviors>       
   </behaviors>         
   <serviceHostingEnvironment aspNetCompatibilityEnabled="true" 
                              multipleSiteBindingsEnabled="true" />   
</system.serviceModel>

Client.config

<system.serviceModel>
   <bindings>
      <wsHttpBinding>
          <binding name="BindingWithMaxSizeIncreased"
                   maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                            maxArrayLength="2147483647" maxBytesPerRead="2147483647" 
                            maxNameTableCharCount="2147483647" />
          </binding>
      </wsHttpBinding>
   </bindings>
   <client>
      <endpoint 
          address="http://localhost:90/MyService.svc" 
          binding="wsHttpBinding" 
          contract="IMyService">
         <identity>
            <dns value="localhost" />
         </identity>
      </endpoint>
   </client>
</system.serviceModel>
1

There are 1 answers

0
Ross Bush On BEST ANSWER

You need to give the custom bindingConfiguration to your endpoint in the client configuration:

<endpoint address="http://localhost:90/MyService.svc" 
    binding="wsHttpBinding" 
    contract="IMyService"
    bindingConfiguration="BindingWithMaxSizeIncreased">
    <identity>
        <dns value="localhost" />
    </identity>
</endpoint>