Fiddler - ReadResponse failed: The server did not

2020-02-12 09:24发布

问题:

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.

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:

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/json because when I try to change it to 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!

回答1:

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.



回答2:

I had the same error couple times because of different issues. Main reason is that wcf cant serialize the object.

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

Regards



回答3:

I had the same problem Fiddler] ReadResponse() failed:. The resolution for me was: In IIS, recycle the application pools in where the app resides.



回答4:

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



回答5:

I have faced the same problem. Finally, found the issue in defining the Contract type for the return object.

I have replaced [DataMember] to [EnumMember] as described below:

[DataContract]
public enum DiscountType
{
    [EnumMember]
    NONE = 0,
    [EnumMember]
    PERCENTAGE_DISCOUNT = 1
}

This fixed my "[Fiddler] ReadResponse() failed" error which took my half day effort.



标签: c# json wcf rest