开发者

WCF REST throws HTTP 400 error maxstringcontentlength quota (8192) exceeded

Based on this post 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" />
    &l开发者_开发技巧t;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>


hey it seem that you are sending more data then it is allowed i.e int.max length, try using custom binding (Binary ) that will help you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜