fiberOptics
fiberOptics

Reputation: 7165

Fiddler - ReadResponse failed: The server did not return a response for this request

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

enter image description here

Fiddler response:

[Fiddler] ReadResponse() failed: The server did not return a response for this request.  

enter image description here

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:

enter image description here

Kinda weird. What I have done wrong? I have to return json object.. Thanks!

Upvotes: 4

Views: 37553

Answers (5)

Karthick Jayaraman
Karthick Jayaraman

Reputation: 301

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.

Upvotes: 0

smoothumut
smoothumut

Reputation: 3491

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

Upvotes: 1

Umesh K.
Umesh K.

Reputation: 311

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

Upvotes: 0

Robert Vogelezang
Robert Vogelezang

Reputation: 153

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

Upvotes: 0

fiberOptics
fiberOptics

Reputation: 7165

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.

Upvotes: 4

Related Questions