0

I'm trying to consume a WCFservice, but i'm getting HTTP 413 error "Request entity too large".

I configured WCF service's web.config with the following:

<system.serviceModel>
    <services>
        <service name="MyCompany.WCF.Payments.SWPayments" behaviorConfiguration="behaviorPayments">
            <endpoint binding="basicHttpBinding" contract="MyCompany.WCF.Payments.Contract.ISWPayments" address="">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="behaviorPayments">
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
            <behavior name="">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_Payments" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
            </binding>
        </basicHttpBinding>
    </bindings> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
    <client>
        <endpoint address="http://server:port/MyCompanyWCFPayments/Payments.svc" binding="basicHttpBinding"  bindingConfiguration="BasicHttpBinding_Payments" contract="MyCompany.WCF.Payments.Contract.ISWPayments"  name="BasicHttpBinding_Payments" />
    </client>   
</system.serviceModel>

As you can see, the properties' values are set with the top value. But i'm getting the HTTP 413 error.

Am I missing something?

Thanks in advance and best regards. Looking forward for your comments on above.

Javi
  • 19
  • 1
  • 7
  • does IIS accept the payload? https://stackoverflow.com/a/30976344/578411 – rene Jun 26 '19 at 06:08
  • Possible duplicate of [(413) Request Entity Too Large | uploadReadAheadSize](https://stackoverflow.com/questions/10122957/413-request-entity-too-large-uploadreadaheadsize) – rene Jun 26 '19 at 06:12

1 Answers1

0

It seems that the server and the client are on the same machine. We should at least ensure the binding configuration is applied in the server. Besides, please do not forget to apply the configuration on the binding configuration of the server by using BindingConfiguration property.

<services>
  <service name="MyCompany.WCF.Payments.SWPayments" behaviorConfiguration="behaviorPayments">
    <endpoint bindingConfiguration="BasicHttpBinding_Payments" binding="basicHttpBinding" contract="MyCompany.WCF.Payments.Contract.ISWPayments" address="">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

Feel free to let me know if the problem still exists.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22
  • Thanks Abraham ... yep, the property "bindingConfiguration" was missed ... now it works like a charm !!!!! – Javi Jun 27 '19 at 11:43
  • If possible, please mark it useful so that whoever encounters the similar issue is willing to read this reply,thanks very much.^_^ – Abraham Qian Jun 27 '19 at 12:08