简体   繁体   English

WCF REST抛出HTTP 400错误maxstringcontentlength配额(8192)

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

Based on this post Error calling a WCF REST service using JSON. 基于这篇文章错误使用JSON调用WCF REST服务。 length quota (8192) exceeded 超出长度配额(8192)

I experienced the same problem when calling my WCF REST Service (hosted on IIS 7) from a console application (using Microsoft.HttpClient library). 从控制台应用程序(使用Microsoft.HttpClient库)调用WCF REST服务(驻留在IIS 7上)时,我遇到了相同的问题。 I have increased the maxStringContentLength="2147483647" on the WCF REST Service config, but it still throws the same error for files bigger than 8KB. 我在WCF REST服务配置上增加了maxStringContentLength =“ 2147483647”,但对于大于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) (注意:没有客户端配置,因为我只是发出HTTP Post请求,所以在使用Fiddler进行测试时遇到相同的问题)

This is my WCF REST config 这是我的WCF REST配置

<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>

嘿,看来您正在发送更多的数据,然后才允许这样做,即int.max长度,请尝试使用自定义绑定(Binary),它将对您有所帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 已超过最大字符串内容长度配额(8192)。增加XmlDictionaryReaderQuotas的MaxStringContentLength属性 - The maximum string content length quota (8192) has been exceeded.Increase the MaxStringContentLength property on the XmlDictionaryReaderQuotas 将 object 发送到 WCF 服务。 反序列化时超出 MaxStringContentLength(8192 字节) - Sending object to WCF service. MaxStringContentLength (8192 bytes) exceeded when deserializing “在读取XML数据时已超出最大字符串内容长度配额(8192)”将XML字符串发送到WCF时出错 - “The maximum string content length quota (8192) has been exceeded while reading XML data” error while sending XML string to WCF 将 XML 字符串发送到 WCF 时出现“读取 XML 数据时已超出最大字符串内容长度配额 (8192)”错误 - "The maximum string content length quota (8192) has been exceeded while reading XML data" error while sending XML string to WCF WCF MaxStringContentLength错误 - WCF MaxStringContentLength error 使用Delphi使用WCF - 最大字符串内容长度配额(8192)错误 - Consuming WCF with Delphi - Maximum string content length quota (8192) error WCF-读取XML数据时超出了最大字符串内容长度配额(8192) - WCF - The maximum string content length quota (8192) has been exceeded while reading XML data WCF Config修复最大字符串内容长度配额(8192) - WCF Config to fix The maximum string content length quota (8192) has been exceeded WCF阅读器配额最大字符串内容长度配额(8192) - WCF reader quota The maximum string content length quota (8192) 反序列化类型的对象时发生错误...读取XML数据时超出了最大字符串内容长度配额(8192) - There was an error deserializing the object of type … The maximum string content length quota (8192) has been exceeded while reading XML data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM