Fiddler - ReadResponse失败:服务器未返回此请求的响应

时间:2021-11-08 19:36:15

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

Fiddler  -  ReadResponse失败:服务器未返回此请求的响应

Fiddler response:

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

Fiddler  -  ReadResponse失败:服务器未返回此请求的响应

I'm not sure if it caused by, Content-type: application/json because 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:

它给了我这个结果:

Fiddler  -  ReadResponse失败:服务器未返回此请求的响应

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

有点奇怪。我做错了什么?我必须返回json对象..谢谢!

5 个解决方案

#1


4  

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 - “数据传输对象”,它将最小化要传递的数据。

#2


1  

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

在我的第一种情况下,这是因为,返回的对象不是服务中声明的正确对象。该服务应该已经返回了student对象,但是我正在返回studentExtended对象(继承对象)。

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属性的形式是不可序列化的(它是null)。所以我把它改成了DateTime.now,所以之后它再次运行了

Regards

#3


0  

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()失败了:我的解决方案是:在IIS中,回收应用程序所在位置的应用程序池。

#4


0  

I was using Xampp and Installed Fiddler...Same Error occured...

我正在使用Xampp和Installed Fiddler ...发生了相同的错误...

I run IIS for just Once (As it was stopped due to running Xampp) and Everything went fine. :)

我只运行一次IIS(由于运行Xampp而停止)并且一切都很顺利。 :)

#5


0  

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()失败”错误,这花了我半天的努力。

#1


4  

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 - “数据传输对象”,它将最小化要传递的数据。

#2


1  

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

在我的第一种情况下,这是因为,返回的对象不是服务中声明的正确对象。该服务应该已经返回了student对象,但是我正在返回studentExtended对象(继承对象)。

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属性的形式是不可序列化的(它是null)。所以我把它改成了DateTime.now,所以之后它再次运行了

Regards

#3


0  

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()失败了:我的解决方案是:在IIS中,回收应用程序所在位置的应用程序池。

#4


0  

I was using Xampp and Installed Fiddler...Same Error occured...

我正在使用Xampp和Installed Fiddler ...发生了相同的错误...

I run IIS for just Once (As it was stopped due to running Xampp) and Everything went fine. :)

我只运行一次IIS(由于运行Xampp而停止)并且一切都很顺利。 :)

#5


0  

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()失败”错误,这花了我半天的努力。