C# Fiddler - ReadResponse 失败:服务器没有为此请求返回响应
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9425288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fiddler - ReadResponse failed: The server did not return a response for this request
提问by fiberOptics
This was the first time I encountered this kind of error after dealing with RESTful web service in couple of times. I find it hard to trace the cause of error, hope you could help me.
这是我在处理过几次 RESTful Web 服务后第一次遇到这种错误。我发现很难追踪错误的原因,希望你能帮助我。
I have this attribute for Login service
我有登录服务的这个属性
[WebGet(UriTemplate = "Login?username={username}&password={password}&ip={ip}", ResponseFormat = WebMessageFormat.Json)]
Using fiddler to use the service:
使用 fiddler 使用服务:
GET http://localhost:3445/Authenticate/Login?username=jsm&password=a&ip=1
GET http://localhost:3445/Authenticate/Login?username=jsm&password=a&ip=1


Fiddler response:
提琴手 回复:
[Fiddler] ReadResponse() failed: The server did not return a response for this request.


I'm not sure if it caused by, Content-type: application/jsonbecause when I try to change it to xml:
我不确定它是否由以下Content-type: application/json原因引起,因为当我尝试将其更改为 xml 时:
[WebGet(UriTemplate = "Login?username={username}&password={password}&ip={ip}", ResponseFormat = WebMessageFormat.Xml)]
It gives me this result:
它给了我这个结果:


Kinda weird. What I have done wrong? I have to return json object.. Thanks!
有点怪。我做错了什么?我必须返回 json 对象..谢谢!
采纳答案by fiberOptics
The cause of error is the loading of bunch data types (see the preview of xml data above). Json has a limit of approximately 65K objects, and in my project it exceeds the limit. So the final solution is to create DTO - "Data Transfer Object" that will minimize the data to be passed.
错误原因是加载了一堆数据类型(见上面xml数据的预览)。Json 有大约 65K 个对象的限制,在我的项目中它超过了限制。所以最终的解决方案是创建 DTO——“数据传输对象”,它将最小化要传递的数据。
回答by Robert Vogelezang
I had the same problem Fiddler] ReadResponse() failed:. The resolution for me was: In IIS, recycle the application pools in where the app resides.
我遇到了同样的问题 Fiddler] ReadResponse() failed:。我的解决方案是:在 IIS 中,回收应用程序所在的应用程序池。
回答by Umesh K.
I was using Xampp and Installed Fiddler...Same Error occured...
I run IIS for just Once(As it was stopped due to running Xampp) and Everything went fine. :)
我正在使用 Xampp 并安装了 Fiddler ......发生了同样的错误......
我只运行了一次 IIS(因为它因为运行 Xampp 而停止了)并且一切顺利。:)
回答by smoothumut
I had the same error couple times because of different issues. Main reason is that wcf cant serialize the object.
由于不同的问题,我有几次相同的错误。主要原因是 wcf 无法序列化对象。
in my first case it was because, the returned object is not the correct object that is stated in service. the service should have returned student object, but I was returning the studentExtended object(inherited object).
在我的第一种情况下,这是因为返回的对象不是服务中声明的正确对象。该服务应该返回学生对象,但我返回了学生扩展对象(继承对象)。
in my second case it was because of dateTime property which was in form that is not serializable (it was null). so I have changed it to DateTime.now so after that it was working again
在我的第二种情况下,这是因为 dateTime 属性的形式不可序列化(它为空)。所以我已将其更改为 DateTime.now 之后它又可以正常工作了
Regards
问候
回答by Karthick Jayaraman
I have faced the same problem. Finally, found the issue in defining the Contract type for the return object.
我遇到了同样的问题。最后,发现了定义返回对象的 Contract 类型的问题。
I have replaced [DataMember] to [EnumMember] as described below:
我已将 [DataMember] 替换为 [EnumMember],如下所述:
[DataContract]
public enum DiscountType
{
[EnumMember]
NONE = 0,
[EnumMember]
PERCENTAGE_DISCOUNT = 1
}
This fixed my "[Fiddler] ReadResponse() failed" error which took my half day effort.
这修复了我花了半天时间的“[Fiddler] ReadResponse() failed”错误。

