views:

77

answers:

1

Based on this post http://stackoverflow.com/questions/2257808/error-calling-a-wcf-rest-service-using-json-length-quota-8192-exceeded

I experienced the same problem when calling my WCF REST Service (hosted on IIS 7) from a console application (using Microsoft.HttpClient library). I have increased the maxStringContentLength="2147483647" on the WCF REST Service config, but it still throws the same error for files bigger than 8KB. (Note: there is no client configuration as I simply make a HTTP Post request, I got the same problem when test it using Fiddler)

This is my WCF REST config

<system.serviceModel>
<bindings>
  <webHttpBinding>
    <binding name="webBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </binding>
  </webHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="ServiceBehavior" name="EmailService">
    <host>
      <baseAddresses>
        <add baseAddress="http://mywebsite.com/v1" />
      </baseAddresses>
    </host>
    <endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" behaviorConfiguration="webBehavior" contract="IEmailService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="webBehavior">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
</behaviors>