gpt4 book ai didi

c# - Fiddler - ReadResponse 失败 : The server did not return a response for this request

转载 作者:太空狗 更新时间:2023-10-30 01:08:26 24 4
gpt4 key购买 nike

这是我在处理了几次 RESTful Web 服务后第一次遇到这种错误。我发现很难追查错误的原因,希望你能帮助我。

我有登录服务的这个属性

[WebGet(UriTemplate = "Login?username={username}&password={password}&ip={ip}", ResponseFormat = WebMessageFormat.Json)]  

使用fiddler使用服务:

获取 http://localhost:3445/Authenticate/Login?username=jsm&password=a&ip=1

enter image description here

fiddler 响应:

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

enter image description here

我不确定它是否由 Content-type: application/json 引起,因为当我尝试将其更改为 xml:

[WebGet(UriTemplate = "Login?username={username}&password={password}&ip={ip}", ResponseFormat = WebMessageFormat.Xml)]  

它给了我这个结果:

enter image description here

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

最佳答案

错误原因是加载了一堆数据类型(见上面xml数据的预览)。 Json 有大约 65K 个对象的限制,在我的项目中它超过了限制。所以最终的解决方案是创建 DTO——“数据传输对象”,它将最小化要传递的数据。

关于c# - Fiddler - ReadResponse 失败 : The server did not return a response for this request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9425288/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com