WCF问题集锦:ReadResponse failed: The server did not return a complete response for this request.
今日。对代码进行单元測试时。发现方法GetAllSupplyTypes报例如以下错误:
[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
经过对照。唯一的差异是该方法返回的数据对象是一个继承于还有一个集合对象的对象,代码例如以下:
/// <summary>
/// SupplyType的值的集合
/// </summary>
[DataContract]
public class SupplyTypeResults : List<SupplyType>
{
/// <summary>
/// 构造函数
/// </summary>
public SupplyTypeResults()
{
this.Add(new SupplyType
{
SupplyTypeId = 2,
SupplyTypeName = "其它投放方式"
}); this.Add(new SupplyType
{
SupplyTypeId = 1,
SupplyTypeName = "平台自己主动投放"
}); this.Add(new SupplyType
{
SupplyTypeId = 0,
SupplyTypeName = "客户主动领取"
});
}
}
当中,SupplyType定义例如以下:
/// <summary>
/// 优惠券发行方式
/// </summary>
[DataContract]
public class SupplyType
{
/// <summary>
/// 发行方式Id
/// </summary>
[DataMember(Name = "supplyTypeId")]
public int SupplyTypeId { get; set; } /// <summary>
/// 发行方式名称
/// </summary>
[DataMember(Name = "supplyTypeName")]
public string SupplyTypeName { get; set; }
}
自以为继承与一个WCF能正常序列化的对象,并且在SupplyTypeResults上也加了DataContract应该没有问题,可是就是报错。
后来不再使用SupplyTypeResults类,在代码中直接使用List<SupplyType>。问题所有解决。
之后。有发现还有一个方法也会产生该问题。可是,该方法不属于此原因范畴。经过一阵排查,发现返回类中有个日期属性没有赋值,导致了该错误的抛出。
经过上述两事件总结能够得出,对于不论什么在序列化过程中可能出错的情况。都会导致server返回0字节数据而报此错误。
WCF问题集锦:ReadResponse failed: The server did not return a complete response for this request.的更多相关文章
- [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
待解决 [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. ...
- file_get_contents HTTP request failed! Internal Server Error
使用file_get_contents报错 Severity: WarningMessage: file_get_contents(http://geetest.com:8000/select?gid ...
- OPENTSDB: Request failed: Internal Server Error net.opentsdb.core.IllegalDataException
今天Opentsdb补传历史数据的时候,出现了如下的错误: Request failed: Internal Server Error net.opentsdb.core.IllegalDataExc ...
- Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html"
2015-11-16 10:39:17.235 PullDemo[338:60b] Application windows are expected to have a root view contr ...
- Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptabl
在使用AFNetworking 2.0 的时候本来一切很顺畅,但是中途遇到几个比较坑的地方 这里分享一下爬坑经历,忘读者不能速爬坑! 在发送请求后,NSURLSessionDataTask一直报错 ...
- svn Server sent unexpected return value (403 Forbidden) in response to CHECKOUT
今天,提交資料到公司svn服務器,但是一直提示 Server sent unexpected return value (403 Forbidden) in response to CHECKOUT ...
- FAIL - Deploy Upload Failed, Exception: [org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (112503036) exceeds the configured
Message: FAIL - Deploy Upload Failed, Exception: [org.apache.tomcat.util.http.fileupload.FileUpload ...
- Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public xxxxxxxx.
最近在使用 springBoot开发的时候, 使用PostMan访问接口, 返回一个 404 , 后台报一个 warn : Failed to read HTTP message: org.spr ...
- recv() failed (104: Connection reset by peer) while reading response header from upstream
2017年12月1日10:18:34 情景描述: 浏览器执行了一会儿, 报500错误 运行环境: nginx + php-fpm nginx日志: recv() failed (104: Conn ...
随机推荐
- mongodb Shell 启动
开始运行mongodb 准备 上篇说过,通过brew安装的程序目录在 /usr/local/Cellar下面 下面,我们先看一下 mongodb的可执行程序命令 cd /usr/local/Cella ...
- python学习小结-字典key,val互换
第一种,使用压缩器: >>> m = {'a': 1, 'b': 2, 'c': 3, 'd': 4} >>> zip(m.values(), m.keys()) ...
- 三维重建PCL:点云单侧面正射投影
终于把点云单侧面投影正射投影的代码写完了,为一个阶段,主要使用平面插值方法,且只以XOY平面作为的正射投影面.有些凑合的地方,待改进. 方法思路:使用Mesh模型,对每一个表面进行表面重建.借助Ope ...
- Linux的网卡由eth0变成了eth1或eth2,如何修复??
背景:做linux下分布式测试的时候,重新安装了两个linux虚拟机,结果分布式脚本没有做好,分布式也没有做成. 今天想练练linux命令,打开vmware,启动linux1 虚拟机,使用ifconf ...
- 16 this和super和构造代码块
this关键词---当前类的对象的引用 public class Public { String name; int age; public static void main(String[] arg ...
- 01Hypertext Preprocessor
Hypertext Preprocessor PHP即Hypertext Preprocessor是一种被广泛使用的开放源代码多用途动态交互性站点的强有力的服务器端脚本语言尤其适用于 Web开发人员可 ...
- Java基础——工具类
一Java 常用类 Object Object类是所有类.数组.枚举类的父类.位于Java.lang包.也就是说,Java允许把任意类型的对象赋给Object类型的变量. Object类的常用方法 1 ...
- 个人 NABCD
失物招领APP个人NABCD Need: 在朋友圈中,QQZone中我们长仓可以看到失物招领这方面的信息,又没有学校中专门使用的失物招领平台,所以根据这个信息,决定开发一款解决这方面问题的APP来满足 ...
- for 循环新的写法==列表解析
1. (for x in L1) 是一个可迭代对象: 2. 列表解析比for 循环快,列表解析的迭代在解释器内部是以C语言速度执行, 而不是手动python代码执行: (x+10 for x in L ...
- python正则表达式提取字符串
用python正则表达式提取字符串 在日常工作中经常遇见在文本中提取特定位置字符串的需求.python的正则性能好,很适合做这类字符串的提取,这里讲一下提取的技巧,正则表达式的基础知识就不说了,有兴趣 ...