?
如果是这样,这里是App.config中,我们使用大数据集的一个例子:
< system.serviceModel>
<绑定>
< basicHttpBinding的>
<绑定名称=basicHttpBinding的maxBufferSize =2147483647maxReceivedMessageSize =2147483647>
< readerQuotas MAXDEPTH =32maxStringContentLength =8388608maxArrayLength =16384maxBytesPerRead =4096maxNameTableCharCount =16384/>
< /装订>
< / basicHttpBinding的>
< /绑定>
<客户端>
<端点地址=HTTP://本地主机:1602 / EndPoint.svc绑定=basicHttpBinding的bindingConfiguration =basicHttpBinding的合同=IEndPointContractNAME =端点behaviorConfiguration =EndpointBehaviour/>
< /客户>
<行为>
< endpointBehaviors>
<行为NAME =EndpointBehaviour>
< DataContractSerializer的maxItemsInObjectGraph =2147483647/>
< /行为>
< / endpointBehaviors>
< /行为>
< /system.serviceModel>
This exception is consistently thrown on a SOAP Request which takes almost three minutes to receive and is 2.25 megs in size.
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.
My <httpRuntime maxRequestLength="409600" executionTimeout="900"/>
.
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.
Thanks
解决方案
You tagged the post as .NET35, so are you using WCF?
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>
这篇关于基础连接已经关闭:连接被意外关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!