這是我在幾次處理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