今日。对代码进行单元測试时。发现方法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.的更多相关文章

  1. [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. ...

  2. file_get_contents HTTP request failed! Internal Server Error

    使用file_get_contents报错 Severity: WarningMessage: file_get_contents(http://geetest.com:8000/select?gid ...

  3. OPENTSDB: Request failed: Internal Server Error net.opentsdb.core.IllegalDataException

    今天Opentsdb补传历史数据的时候,出现了如下的错误: Request failed: Internal Server Error net.opentsdb.core.IllegalDataExc ...

  4. 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 ...

  5. Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptabl

    在使用AFNetworking 2.0  的时候本来一切很顺畅,但是中途遇到几个比较坑的地方 这里分享一下爬坑经历,忘读者不能速爬坑! 在发送请求后,NSURLSessionDataTask一直报错 ...

  6. svn Server sent unexpected return value (403 Forbidden) in response to CHECKOUT

    今天,提交資料到公司svn服務器,但是一直提示 Server sent unexpected return value (403 Forbidden) in response to CHECKOUT ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. JSP参数传递兼EL表达式

    1.浏览器?方式传递参数 /** 浏览器地址栏输入?方式传递参数 ?test=123 */ 可以用${param.test}方式输出 2.页面内部设置参数setAttribute /** JSP页面中 ...

  2. java web 学习笔记 - Java Bean

    1. Java Bean 是一个简单的 java 类,一般放在WEB-INF下的 classes目录下(如果没有则需要手工新建) 一个简单的Bean包括属性,getter ,setter方法,如果没有 ...

  3. 扩增子分析解读2提取barcode 质控及样品拆分 切除扩增引物

    本节课程,需要完成扩增子分析解读1质控 实验设计 双端序列合并 先看一下扩增子分析的整体流程,从下向上逐层分析 分析前准备 # 进入工作目录 cd example_PE250 上一节回顾:我们拿到了双 ...

  4. 解决[disabled]="true"与formControlName冲突

    import { FormBuilder } from '@angular/forms'; form; constructor(private fb: FormBuilder) { this.form ...

  5. python 3 Urllib 数据抓取

    1.0 Urllib简介 Urllib是python自带的标准库,无需安装,直接引用即可.urllib通常用于爬虫开发,API(应用程序编程接口)数据获取和测试.在python2和python3中,u ...

  6. 梦想MxWeb3D协同设计平台 2019.01.24更新

    SDK开发包下载地址:http://www.mxdraw.com/ndetail_10124.html1.  编写快速入门教程2.  重构前端代码,支持一个页面多个三维控件同时加载,或二维和三维同时加 ...

  7. java_IO_1

    public class DirStudy { public static void main(String[] args) { File file = new File("F:/Eclip ...

  8. 【Redis】二、Redis高级特性

    (三) Redis高级特性   前面我们介绍了Redis的五种基本的数据类型,灵活运用这五种数据类型是使用Redis的基础,除此之外,Redis还有一些特性,掌握这些特性能对Redis有进一步的了解, ...

  9. Manacher算法(马拉车算法)浅谈

    什么是Manacher算法? 转载自百度百科 Manachar算法主要是处理字符串中关于回文串的问题的,它可以在 O(n) 的时间处理出以字符串中每一个字符为中心的回文串半径,由于将原字符串处理成两倍 ...

  10. CCF201604-1 折点计数 java(100分)

    试题编号: 201604-1 试题名称: 折点计数 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 给定n个整数表示一个商店连续n天的销售量.如果某天之前销售量在增长,而后一天 ...