【问题标题】:Request entity too large error(413) in WCFWCF 中的请求实体太大错误(413)
【发布时间】:2015-05-03 19:50:08
【问题描述】:

即使 maxReceivedMessageSize 设置为最大值,即 2147483647 并且实际消息大小小于 50kb,我在 WCF 服务中也面临 413 错误。

仅当两个请求之间存在一些理想时间时才会出现此问题。 确切的场景如下: 1. 发送 1000 条消息,每条消息大约 38 kb。状态:通过 2. 等待一段时间(最少 3 分钟) 3. 发送 1 条消息。状态:失败。 (413 错误)

我正在使用 ws2007FederationHttpBinding。 Web.config 标签如下:

<ws2007FederationHttpBinding>
    <binding name="federationHttpBinding" openTimeout="00:04:00" closeTimeout="00:04:00" receiveTimeout="00:04:00" sendTimeout="00:40:00" maxReceivedMessageSize="2147483647">
      <!-- <readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" /> -->
      <security mode="TransportWithMessageCredential">
        <message establishSecurityContext="false">
        </message>
      </security>
    </binding>
  </ws2007FederationHttpBinding>

客户端绑定标签如下:

<ws2007FederationHttpBinding>
    <binding name="AuthorizationBinding" openTimeout="00:04:00" closeTimeout="00:04:00" receiveTimeout="00:04:00" sendTimeout="00:40:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
      <readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
      <security mode="TransportWithMessageCredential">
        <message establishSecurityContext="false"/>
      </security>
    </binding>
</ws2007FederationHttpBinding>

【问题讨论】:

    标签: c# .net wcf iis-7 wcf-binding


    【解决方案1】:

    您还必须设置 maxBufferSize

        <binding name="federationHttpBinding" 
                 maxReceivedMessageSize="2147483647" 
                 maxBufferSize="2147483647"
                 maxBufferPoolSize="2147483647">
    

    【讨论】:

    • 它不工作。 maxBufferSize 是无效属性并添加了 maxBufferPoolSize 但仍然是同样的问题
    • 您在哪里托管服务?如果它在 iis 中,可能需要增加一些通用的消息大小
    【解决方案2】:

    我认为你可以通过从绑定标签中删除 name 属性来解决这个问题,类似的问题可以在这里找到

    WCF service maxReceivedMessageSize basicHttpBinding issue

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-08
      • 2020-02-05
      • 2012-11-14
      • 2015-10-18
      • 2011-02-22
      • 1970-01-01
      • 2016-11-14
      • 2016-02-01
      相关资源
      最近更新 更多