0

I've read many posts about it but I don't know what happens with my web.config.

This is de web.config code:

  <system.serviceModel>
<client>
  <endpoint binding="basicHttpBinding" bindingConfiguration="NewBinding0"
    contract="Service.IService" />
</client>
<bindings>
  <basicHttpBinding>
    <binding name="NewBinding0" closeTimeout="00:05:00" openTimeout="00:05:00"
      sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
      maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
  <webHttpBinding>
    <binding name="NewBinding1" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </webHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

I'm so sorry but I am not familiarized with the web.conf files. I've read that I have to set the maxReceivedMessageSize, but I've done it and I've received the same error.

I'm editing the file with Microsoft Service Configuration Editor. I've tried with basicHttpBinding and without webHttpBinding, but does not work.

Every time I call the WCF, I receive the same error.

Trying in SOAPUI, when the message size is less than 65537, it works. When the message size is more than 65536, it does not work.

Thaks in advance.

Carles

  • Possible duplicate of [IIS7 - (413) Request Entity Too Large | uploadReadAheadSize](http://stackoverflow.com/questions/10122957/iis7-413-request-entity-too-large-uploadreadaheadsize) – stuartd Jun 17 '16 at 08:58
  • Have you set these same values on both the server and the client? They will need to match. – R. Richards Jun 17 '16 at 17:42

2 Answers2

0

Here is the working code of app.config-

<bindings>
    <webHttpBinding>
        <binding name="myBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" transferMode="Streamed" >
            <readerQuotas maxDepth="64" maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
        </binding>
    </webHttpBinding>
</bindings>
<services>
    <service behaviorConfiguration="ForecastREST_API.RESTServiceImplBehavior" name="ForecastREST_API.RestServiceImpl">
        <endpoint address="http://localhost:59624/RestServiceImpl.svc" binding="webHttpBinding" contract="ForecastREST_API.IRestServiceImpl" behaviorConfiguration="Web" bindingConfiguration="myBinding">
            </identity>
        </endpoint>
        <endpoint address="mex" binding="webHttpBinding" contract="IMetadataExchange"/>
    </service>
</services>
<behaviors>
    <endpointBehaviors>
        <behavior name="Web">
            <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            <webHttp defaultOutgoingResponseFormat="Json" automaticFormatSelectionEnabled="true" />
            <dispatcherSynchronization asynchronousSendEnabled="true" />
        </behavior>
    </endpointBehaviors>
    <serviceBehaviors>
        <behavior name="ForecastREST_API.RESTServiceImplBehavior">
            <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
            <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
    </serviceBehaviors>
</behaviors>
Upasak Poddar
  • 73
  • 2
  • 12
0

The maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" and the bindingConfiguration="myBinding" is important only in service endpoint section and the bindingName is needed also in my project.