这是我在几次处理RESTful Web服务后第一次遇到这种错误。我发现很难追查错误的原因,希望你能帮助我。Fiddler - ReadResponse失败:服务器未对此请求返回响应
我有登录服务这个属性
[WebGet(UriTemplate = "Login?username={username}&password={password}&ip={ip}", ResponseFormat = WebMessageFormat.Json)]
使用招使用的服务:
GET http://localhost:3445/Authenticate/Login?username=jsm&password=a&ip=1
提琴手响应:
[Fiddler] ReadResponse() failed: The server did not return a response for this request.
我不知道,如果它引起的,因为Content-type: application/json
当我尝试将其更改为xml:
[WebGet(UriTemplate = "Login?username={username}&password={password}&ip={ip}", ResponseFormat = WebMessageFormat.Xml)]
它给了我这样的结果:
有点奇怪。我做错了什么?我必须返回json对象..谢谢!
我想我必须改变我用于测试Rest的工具。对于所有能够阅读此问题的人员,您可以建议测试Rest的什么工具?一种能够使用像POST,GET,PUT等协议的工具。除了小提琴手之外的工具..?谢谢 – fiberOptics 2012-02-24 07:52:40
fiddler对我来说一直很不错。上面的问题对于ResponseFormat = WebMessageFormat.Json并不少见。我喜欢看着RAW选项卡的Fiddler。 – peterept 2012-02-24 08:49:11
您可以尝试从WebGet atrribute中删除ResponseFormat属性,并检查它是否有效。默认是xml,但是如果你指定你的content-type到application/json,那么WCF Rest Api是智能的,能以客户端可以理解的格式回复 – Rajesh 2012-02-24 10:13:49