今日。对代码进行单元測试时。发现方法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. echarts之我用

    最近在用echarts做项目,抽点时间总结一下. 首先说一下什么是echarts.echarts是百度开发的类似于fusioncharts的图表展示控件.区别于fusioncharts的是echart ...

  2. POJ_1018_(dp)

    Communication System Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 28273   Accepted:  ...

  3. LR性能分析随笔(一)

    一.关键词 吞吐量:对于吞吐量,单位时间内吞吐量越大,说明服务器的处理能力越好:而请求数仅表示客户端向服务器发出的请求数,与吞吐量一般成正比关系. HTTP:HTTP404表示文件或目录没有找到.有些 ...

  4. 梦想CAD控件COM接口自定义命令

    在CAD软件操作中,为方便使用者,使用自定义命令发出命令,完成CAD绘图,修改,保存等操作.点击此处下载演示实例. _DMxDrawX::RegistUserCustomCommand 向CAD控件注 ...

  5. 通过Oracle函数SQL实现C# String.Format字符串格式化功能

    语言国际化要求,开发上要求Oracle数据库SQL中对应的返回信息-Message,实现一个通用函数调用,比如:提示信息内容:条码123456当前工站在FCT!”,即通用的信息内容格式化标准为:“条码 ...

  6. Docker 安装并定制 Nginx 服务器

    安装并定制 Nginx 1.查阅对应的官方文档,首先下载镜像文件: [spider@izwz9d74k4cznxtxjeeur9z local]$ sudo docker pull nginx [su ...

  7. 向appstore提交app流程

    http://www.cocoachina.com/newbie/tutorial/2013/0508/6155.html http://blog.csdn.net/holydancer/articl ...

  8. 39页第3题 求x的n次幂

    /*计算x的n次幂*/ #include<stdio.h> main(void) { int i,n; double x,y; printf("Enter x:");/ ...

  9. Flask保存或解压上传的文件

    import os import uuid import shutil import zipfile from flask import Flask, render_template, request ...

  10. (一)U-Boot启动过程--详细版的完全分析

    博客地址:http://blog.csdn.net/hare_lee/article/details/6916325