“基础连接已关闭:接收时发生意外错误."在WCF中 [英] "The underlying connection was closed: An unexpected error occurred on a receive." in wcf

查看:108
本文介绍了“基础连接已关闭:接收时发生意外错误."在WCF中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨friendz,
我正在从Sql Server中获取大量数据(联系人).我正在获取以下错误...

错误:

收到对http://localhost:8732/Design_Time_Addresses/ICloudServices/ContactService/的HTTP响应时发生错误.这可能是由于服务端点绑定未使用HTTP协议.这也可能是由于服务器终止了HTTP请求上下文(可能是由于服务关闭了).有关更多详细信息,请参阅服务器日志.

{底层连接已关闭:接收时发生意外错误."}

我的wcf web.config文件:

hi friendz,
i am getting the huge amount of data(Contacts) from Sql server..i am getting the following error...

Error:

An error occurred while receiving the HTTP response to http://localhost:8732/Design_Time_Addresses/ICloudServices/ContactService/. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

{"The underlying connection was closed: An unexpected error occurred on a receive."}

My wcf web.config file:

<service name="ICloudServices.ContactService">
   <endpoint address="" binding="basicHttpBinding" contract="ICloudServices.IContactService">
     <identity>
       <dns value="localhost" />
     </identity>
   </endpoint>
   <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   <host>
     <baseAddresses>
       <add baseAddress="http://localhost:8732/Design_Time_Addresses/ICloudServices/ContactService/" />
     </baseAddresses>
   </host>
 </service>





<bindings>
    <basicHttpBinding>
      <binding name="basicHttpBindingSettings"  openTimeout="00:01:00" receiveTimeout="05:00:00" sendTimeout="05:00:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
        <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      </binding>
    </basicHttpBinding>
  </bindings>
  <behaviors>
    <serviceBehaviors>
      <behavior>
        <dataContractSerializer maxItemsInObjectGraph="2147483647" />

        <!-- To avoid disclosing metadata information,
        set the value below to false and remove the metadata endpoint above before deployment -->
        <serviceMetadata httpGetEnabled="True"/>
        <!-- To receive exception details in faults for debugging purposes,
        set the value below to true.  Set to false before deployment
        to avoid disclosing exception information -->
        <serviceDebug includeExceptionDetailInFaults="False" />
      </behavior>
    </serviceBehaviors>
  </behaviors>



在此先感谢



Thanks in advance

推荐答案

在这里,如果您的receiveTimeout不够大,则可能会发生这种异常.
在此处的配置中,您要设置
Here this kind of exception can happen if your receiveTimeout is not large enough.
Here in your configuration, you are setting
receiveTimeout="05:00:00"

中的"binding name ="basicHttpBindingSettings"",但您未将其与端点关联.
从绑定中删除name属性,以便basicHttpBinding将其用作默认绑定配置.或在您的basicHttpBinding中添加

in "binding name="basicHttpBindingSettings" " but you are not associating it with your end point.
Either remove the name attribute from the binding so that basicHttpBinding will use it as default binding configuration. Or add

bindingConfiguration="basicHttpBindingSettings"

端点.希望这会起作用.

to your basicHttpBinding endpoint. Hope this will work.



这篇关于“基础连接已关闭:接收时发生意外错误."在WCF中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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