底层连接已关闭:连接意外关闭 [英] The underlying connection was closed: The connection was closed unexpectedly

查看:50
本文介绍了底层连接已关闭:连接意外关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此异常始终在 SOAP 请求上引发,该请求需要将近三分钟才能接收并且大小为 2.25 兆.

This exception is consistently thrown on a SOAP Request which takes almost three minutes to receive and is 2.25 megs in size.

在网上搜索时,我发现各种各样的帖子似乎都是关于在请求上设置标题,有些人希望我不要发送Expect:"标题,有些人希望我发送Keep-Alive:"标头,但不管我发送的标头如何,我仍然会遇到这个讨厌的错误.我不相信设置任何标题是我的答案,因为我可以使用curl"重新创建完全相同的请求,并且响应最终会毫无问题地返回.

When scouring the web I find all sorts of posts which all seem to be about setting headers on the Request, some want me to not send the "Expect:" header, some want me to send the "Keep-Alive:" header, but irregardless of the headers I send I still get this pesky error. I don't believe that setting any headers is my answer, because I can recreate the exact same request using "curl" and a response does eventually come back with no problems what-so-ever.

我的.

我觉得我的选择已经用完了.如果有人可以提供任何帮助,我将不胜感激.其他一些需要注意的事情是,我从中请求数据的服务器不在我的掌控之中,而且这些请求是通过 https 传输的,而其他响应较小的请求也可以完美地工作.

I feel as if I'm running out of options. If anyone can provide any assistance I would be most grateful. A few other things to note would be that the server I'm Requesting data from is out of my hands, also these requests are over https and other requests with smaller responses work flawlessly.

谢谢

推荐答案

您将帖子标记为 .NET35,那么您使用 WCF 吗?

You tagged the post as .NET35, so are you using WCF?

如果是这样,以下是我们用于大型数据集的 App.config 示例:

If so, here is an example of the App.config we use for large data sets:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="8388608" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:1602/EndPoint.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding" contract="IEndPointContract" name="EndPoint" behaviorConfiguration="EndpointBehaviour" />     
    </client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="EndpointBehaviour">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>

这篇关于底层连接已关闭:连接意外关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆