【问题标题】:WCF REST - maxMessageSize exceededWCF REST - 超出 maxMessageSize
【发布时间】:2015-02-08 15:48:17
【问题描述】:

以下是部分配置文件:

<services>
  <service name="MMC.API2.MMCApi" behaviorConfiguration="restBehaviorConfig">
    <endpoint address="" binding="webHttpBinding" contract="MMC.API2.IMMCApi" behaviorConfiguration="web" bindingConfiguration="LargeData">
    </endpoint>
    <host>
      <timeouts openTimeout="01:20:00" closeTimeout="01:20:00" />
    </host>
  </service>
</services>

...

     <webHttpBinding>
        <binding name="LargeData" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
        </binding>
      </webHttpBinding>

问题:

已超出传入邮件的最大邮件大小配额 (65536)。要增加配额,请在适当的绑定元素上使用 MaxReceivedMessageSize 属性。

【问题讨论】:

  • 尝试在 web.config 中增加 httpRunTime maxRequestLength

标签: wcf wcf-rest


【解决方案1】:

我觉得很好。尝试如下更改行为配置;

  <serviceBehaviors>
    <behavior name="web">
      <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceTimeouts transactionTimeout="00:10:00" />
      <serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="100"
        maxConcurrentInstances="100" />
    </behavior>
  </serviceBehaviors>

【讨论】:

  • 可能是系统网络标签的原因? 在 system.web 标签中
【解决方案2】:

服务绑定配置的片段似乎设置正确,因此您可能需要查看客户端的绑定配置,以确保它们具有相似的 readerQuotas 和 maxBuffer* 设置。

注意事项:
您可能需要提供有关整体环境/配置的更多信息。
如果您尚未启用 WCF 跟踪日志记录,可能会帮助您识别问题。

【讨论】:

  • WCF REST 服务由 ASP.NET MVC 应用程序激活。
  • ASP.NET MVC 应用程序应该使用类似于“LargeData”绑定定义的绑定配置。
  • 我发布的是 ASP.NET MVC web.config 文件的一部分。
猜你喜欢
  • 2015-08-10
  • 1970-01-01
  • 1970-01-01
  • 2011-10-13
  • 2021-01-30
  • 1970-01-01
  • 2011-01-16
  • 2013-04-02
  • 1970-01-01
相关资源
最近更新 更多