WCF 错误:101 页面不可用

发布于 2024-10-27 07:28:17 字数 2513 浏览 1 评论 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>

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

此致,

I have this problem on WCF Rest service. When the data gets bigger like more than 1.2MB it will give me a "Error:101 This webpage is not available" in chrome. In firefox its "The connection was reset". However, it will work on small data. The data is just a plain JSON by the way.

Below is my configuration:

WebConfig(Binding Configuration):

<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(Binding Configuration):

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

I've been struggling on this for hours now. Your thoughts is greatly appreciated.

Best regards,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

并安 2024-11-03 07:28:17

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

<httpRuntime maxRequestLength="8192" />

默认为 8MG,但您可以将其设置为 1MB。有关信息,请查看此处

If you are running IIS, you need to make sure that max HTTP post size is set:

<httpRuntime maxRequestLength="8192" />

8MG is the default but your case could be set at 1MB. For info look here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文