【问题标题】:The remote server returned an unexpected response: (413) Request Entity Too Large exception when using custom binding远程服务器返回意外响应:(413) Request Entity Too Large exception when using custom binding
【发布时间】:2020-12-23 17:00:35
【问题描述】:

我有一个 WCF Web 服务,我可以在其中发送数据。如果数据的大小很大,则会出现此错误。对于小数据,这个问题不会来。以下是我的服务器端点配置,

   <bindings>
  <customBinding>
    <binding name="default" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00" openTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
      <binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" >
         <readerQuotas maxDepth="32767" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="32767" maxNameTableCharCount="2147483647" />
      </binaryMessageEncoding>
          <httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
    </binding>
    <binding name="PublishConfig" closeTimeout="infinite" sendTimeout="infinite" receiveTimeout="infinite" openTimeout="infinite">
      <binaryMessageEncoding>
         <readerQuotas maxDepth="32767" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="32767" maxNameTableCharCount="2147483647" />
      </binaryMessageEncoding>
      <httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
    </binding>
  </customBinding>
</bindings>

这似乎能够获得正确的绑定配置,但不知道为什么它没有使用它。我知道这个问题已经被问过很多次了,但不幸的是他们都没有解决我的问题。 提前致谢。

【问题讨论】:

    标签: wcf wcf-data-services wcf-binding


    【解决方案1】:

    我认为您需要增加绑定的配额。

    【讨论】:

      【解决方案2】:

      在客户端和服务器的配置中添加以下配置解决了这个问题。

      <security>
        <requestFiltering>
          <requestLimits maxAllowedContentLength="1073741824" />
        </requestFiltering>
      </security>
      

      请求限制的默认值为 30000000,大约为 28.6MB。在我的情况下,数据超过 40MB。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-10-05
        • 1970-01-01
        相关资源
        最近更新 更多