当我像这样在 RestSharp 中提出请求时:
var response = client.Execute<bool>(request);
我收到以下错误:
"Unable to cast object of type 'System.Boolean' to type 'System.Collections.Generic.IDictionary`2[System.String,System.Object]'."
这是完整的 HTTP 响应,每个 Fiddler:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 01 Apr 2013 15:09:14 GMT
Content-Length: 5
false
似乎所有的反应都符合犹太教规,那又是什么呢?
另外,如果我通过返回一个简单的值而不是一个对象来对我的 WebAPI 控制器做一些愚蠢的事情并且可以解决我的问题,请随时提出建议。