Bug record1: The underlying connection was closed: The connection was closed unexpectedly.Then
来源:互联网 发布:js获取手机滚动条位置 编辑:程序博客网 时间:2024/06/05 17:23
Description:
Setting up a c# console form for testing another web service called api.svc.
After running the web service and make sure it is running correctly, we create the service reference inside tester program.
It connect the two program successfully, but when do a request, at the receiving data point, keep on meeting this error:
The underlying connection was closed: The connection was closed unexpectedly.
First I thought it would be time out or receiving data too big. So I make following changes:
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<security mode="Message">
<!--<transport clientCredentialType="None" proxyCredentialType="None"/>-->
<message clientCredentialType="UserName" negotiateServiceCredential="false"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
in both project and
<sessionState mode="InProc" cookieless="false" timeout="40" sessionIDManagerType="BotDetect.Web.CustomSessionIdManager, BotDetect" />
on the server end.
Nothing fixed.
After test piece by piece, found here is the point that causing this error:
[System.Xml.Serialization.XmlElementAttribute("xxxxxxxxxxCOU", typeof(xxxxxxxCOUType))]
[System.Xml.Serialization.XmlElementAttribute("xxxxxxxxxxNew", typeof(xxxxxxxNewType))]
[DataMember]
public object Item
{
get
{
return this.itemField;
}
set
{
this.itemField = value;
}
}
this is a field inside a class.
Note: in order to import all the classes and its fields, methods, need to add [DataContract] at the top of the class and [DataMember] at top of all public fields.
It is not passing the possible types to the test program.
In order to inform test program about it, we need to add the following to the top of the class (Notice:not the field, but the class)
[KnownType(typeof(xxxxxxxCOUType))]
[KnownType(typeof(xxxxxxxNewType))]
Then, the test program would recognize object item which type it is.
- Bug record1: The underlying connection was closed: The connection was closed unexpectedly.Then
- The underlying connection was closed错误
- The underlying connection was closed错误
- 解决"The underlying connection was closed: A connection that was expected to be kept alive was closed"
- The underlying connection was closed:Could not establish trust relationship for the SSL/TLS secure
- The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure
- The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure
- HttpWebRequest:基础连接已关闭异常:The underlying connection was closed。
- No operations allowed after connection closed.Connection was implicitly closed by the driver
- java.sql.SQLException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exceptio
- Qtcpsocket The remote host closed the connection
- myBatis连接MySQL报异常:No operations allowed after connection closed.Connection was implicitly closed
- mysql No operations allowed after connection closed.Connection was implicitly closed due to underly
- nodejs mysql Error: Connection lost The server closed the connection
- 再谈Hibernate the owing session was closed
- hibernate:the owning Session was closed
- Invalid state, the Connection object is closed.
- SqliteOpenHelper the connection pool has been closed
- DuiLib介绍及其消息处理剖析
- 动态规划题集
- UVA 10917 Walk Through the Forest(Dijkstra+DAG动态规划)
- [2015-07-22] python007
- 二叉树题目集
- Bug record1: The underlying connection was closed: The connection was closed unexpectedly.Then
- 抽象类与接口
- IOS初学者之C语言基础 连载一
- 2015-07-22
- 网络编程socket基本API详解
- 各种排序算法的复杂度
- Selenium学习笔记之013:控制滚动条到底部
- 设计模式之创建者模式
- cocos2d-x 入门之初次使用