2009-10-15 19 views
10

estoy recibiendo este error:WCF MaxReceivedMessageSize: cuota máxima tamaño del mensaje excede

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.

¿Cómo puedo aumentar este valor en la aplicación cliente de WCF o la aplicación de servidor, y si es posible un ejemplo de cómo se hace esto ?

Respuesta

18

a aumentar en el lado del cliente en app/web.config:

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="WSBigQuotaConfig" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="2097152" maxArrayLength="2097152" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> 
       <security mode="None"> 
        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
        <message clientCredentialType="UserName" algorithmSuite="Default"/> 
       </security> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 

    <client> 
     <endpoint 
      address="http://example.com/endpoint.svc" 
      binding="basicHttpBinding" 
      bindingConfiguration="WSBigQuotaConfig" 
      contract="ISomeServiceContract" /> 
    </client> 
</system.serviceModel> 
+4

+1 y Aceptado, pero también vale la pena mencionar que cuando el modo de transferencia = tamponada - MaxBufferSize y maxReceivedMessageSize debe contener el mismo valor .... –

+1

Una discrepancia entre maxBufferSize y maxReceivedMessageSize da excepción. – Kangkan

3

Es necesario configurar el atributo MaxReceivedMessageSize en su configuración de enlace. De forma predeterminada, es 65536. Supongo que está utilizando conjuntos de datos o algo de esa naturaleza que terminan siendo bastante grandes (sobre todo porque normalmente están representados con XML).

La buena noticia es que creo que solo necesita cambiar esto en la configuración de su cliente. Eche un vistazo a continuación.

<bindings> 
    <netTcpBinding> 
     <binding name="MyTcpBinding" 
       maxReceivedMessageSize="2000000"/> 
    </netTcpBinding> 
<bindings> 
1

<bindings> 
    <wsHttpBinding> 
    <binding name="wsHttpBinding_Username" maxReceivedMessageSize="20000000"   maxBufferPoolSize="20000000"> 
     <security mode="TransportWithMessageCredential"> 
     <message clientCredentialType="UserName" establishSecurityContext="false"/> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

<client> 
    <endpoint 
      binding="wsHttpBinding" 
      bindingConfiguration="wsHttpBinding_Username" 
      contract="Exchange.Exweb.ExchangeServices.ExchangeServicesGenericProxy.ExchangeServicesType" 
      name="ServicesFacadeEndpoint" /> 
</client> 

Cuestiones relacionadas