WCF错误:101页面不可用

时间:2011-03-28 00:11:56

标签: .net wcf wcf-binding wcf-rest

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

我几个小时以来一直在努力奋斗。非常感谢您的想法。

致以最诚挚的问候,

1 个答案:

答案 0 :(得分:0)

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

<httpRuntime maxRequestLength="8192" />

8MG是默认设置,但您的情况可以设置为1MB。有关信息,请查看here