0

我在 WCF Rest 服务上有这个问题。当数据变得超过 1.2MB 时,它会在 chrome 中给我一个“错误:101 此网页不可用”。在 Firefox 中,它的“连接已重置”。但是,它适用于小数据。顺便说一下,数据只是一个普通的 JSON。

下面是我的配置:

WebConfig(绑定配置):

<basicHttpBinding>
    <binding name="basicHttpBindingConfig" 
        closeTimeout="00:30:00" 
        openTimeout="00:30:00" 
        receiveTimeout="Infinite" 
        sendTimeout="00:30:00" 
        maxBufferPoolSize="2147483647" 
        maxReceivedMessageSize="2147483647" 
        maxBufferSize="2147483647">
                <readerQuotas 
        maxDepth="2147483647" 
        maxStringContentLength="2147483647" 
        maxArrayLength="2147483646" 
        maxBytesPerRead="2147483647" 
        maxNameTableCharCount="2147483647" />
    </binding>
</basicHttpBinding>

  <webHttpBinding>
    <binding name="webclientHttpBindingConfig" 
        closeTimeout="00:30:00" 
        openTimeout="00:30:00" 
        receiveTimeout="Infinite" 
        sendTimeout="00:30:00" 
        maxBufferPoolSize="2147483647" 
        maxReceivedMessageSize="2147483647" 
        maxBufferSize="2147483647">
      <readerQuotas 
        maxDepth="2147483647" 
        maxStringContentLength="2147483647" 
        maxArrayLength="2147483646" 
        maxBytesPerRead="2147483647" 
        maxNameTableCharCount="2147483647" />
    </binding>
  </webHttpBinding>

AppConfig(绑定配置):

   <basicHttpBinding>
    <binding name="basicBindingForBigArrays" 
        maxBufferSize="2147483647"
        maxBufferPoolSize="2147483647" 
        maxReceivedMessageSize="2147483647"
        messageEncoding="Mtom">
      <readerQuotas 
        maxDepth="2147483647" 
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647" 
        maxBytesPerRead="2147483647" 
        maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>

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

我已经为此苦苦挣扎了几个小时。非常感谢您的想法。

此致,

4

1 回答 1

0

如果您正在运行 IIS,则需要确保设置了最大 HTTP 帖子大小:

<httpRuntime maxRequestLength="8192" />

8MG 是默认值,但您的情况可以设置为 1MB。信息看这里

于 2011-03-28T00:16:43.053 回答