为什么 Jayrock(.NET JSON-RPC 框架)不喜欢我的请求?
您好,关于 Jayrock 的快速问题...我有一个 Jayrock JSON-RPC Web 服务,通常运行良好。 但是,当我尝试发布到 jqGrid editUrl 时,Jayrock 抛出错误。 Web 服务在其他情况下工作正常。
有人知道为什么 Jayrock 不喜欢以下请求吗? 也许有一种方法可以配置 Jayrock 来接受此请求?
请求:
发布 /StoryManager/StoryManager.ashx/setPageItemRoles HTTP/1.1
主机:本地主机:2064
用户代理:Mozilla/5.0(Windows;U; Windows NT 5.1; en-美国; 版本:1.9.1) Gecko/20090624 Firefox/3.5(.NET CLR 3.5.30729)
接受:*/*
接受语言:en-us,en;q=0.5
接受编码:gzip、deflate
接受字符集: ISO-8859-1,utf-8;q=0.7,*;q=0.7
保持活动:300
连接:保持活动状态
内容类型: 应用程序/x-www-form-urlencoded; 字符集=UTF-8
X-Requested-With:XMLHttpRequest
推荐人: http://localhost:2064/StoryManager/PageItemDetail.aspx
内容长度:183
Cookie: ASP.NET_SessionId=uycy1qmowzzqhiac1kg3e455
编译指示:无缓存
缓存控制:无缓存
标题=叙述&分配给=dfghdfgh&分配=2009-06-25T14%3A52%3A24.0868931-05%3A00&到期=2009-08-02T14%3A52%3A24.0868931-05%3A00&完成=2009 -07-17T14%3A52%3A24.0868931-05%3A00&id=3
响应:
{"id":null,"error":{"name":"JSONRPCError","message":"找到 对象所在的字符串 预期。","stackTrace":" 在 Jayrock.Json.JsonReader.ReadToken(JsonTokenClass 令牌)中 c:\ Projects \ Public \ Jayrock \ rel \ rel-0.9.8316 \ src \ Jayrock.Json \ Json \ JsonReader.cs:行 142\r\n 在 Jayrock.JsonRpc.JsonRpcDispatcher.ParseRequest(TextReader 输入)在 c:\ Projects \ Public \ Jayrock \ rel \ rel-0.9.8316 \ src \ Jayrock \ JsonRpc \ JsonRpcDispatcher.cs:行 271\r\n 在 Jayrock.JsonRpc.JsonRpcDispatcher.Process(TextReader 输入,TextWriter 输出)中 c:\ Projects \ Public \ Jayrock \ rel \ rel-0.9.8316 \ src \ Jayrock \ JsonRpc \ JsonRpcDispatcher.cs:行 127","错误":[{"名称":"JsonException","消息":"找到 需要 Object 的字符串。"}]}}
Hi quick question about Jayrock... I have a Jayrock JSON-RPC web service that generally works fine. However, when I try to post to my jqGrid editUrl, Jayrock throws an error. The web service works fine in other situations.
Anyone have a clue why Jayrock doesn't like the following request? Perhaps a way to configure Jayrock to accept this request?
Request:
POST
/StoryManager/StoryManager.ashx/setPageItemRoles
HTTP/1.1Host: localhost:2064
User-Agent: Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.9.1)
Gecko/20090624 Firefox/3.5 (.NET CLR
3.5.30729)Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset:
ISO-8859-1,utf-8;q=0.7,*;q=0.7Keep-Alive: 300
Connection: keep-alive
Content-Type:
application/x-www-form-urlencoded;
charset=UTF-8X-Requested-With: XMLHttpRequest
Referer:
http://localhost:2064/StoryManager/PageItemDetail.aspxContent-Length: 183
Cookie:
ASP.NET_SessionId=uycy1qmowzzqhiac1kg3e455Pragma: no-cache
Cache-Control: no-cache
title=Narrative&assignedto=dfghdfgh&assigned=2009-06-25T14%3A52%3A24.0868931-05%3A00&due=2009-08-02T14%3A52%3A24.0868931-05%3A00&completed=2009-07-17T14%3A52%3A24.0868931-05%3A00&id=3
Response:
{"id":null,"error":{"name":"JSONRPCError","message":"Found
String where Object was
expected.","stackTrace":" at
Jayrock.Json.JsonReader.ReadToken(JsonTokenClass
token) in
c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock.Json\Json\JsonReader.cs:line
142\r\n at
Jayrock.JsonRpc.JsonRpcDispatcher.ParseRequest(TextReader
input) in
c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock\JsonRpc\JsonRpcDispatcher.cs:line
271\r\n at
Jayrock.JsonRpc.JsonRpcDispatcher.Process(TextReader
input, TextWriter output) in
c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock\JsonRpc\JsonRpcDispatcher.cs:line
127","errors":[{"name":"JsonException","message":"Found
String where Object was expected."}]}}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为您使用“类似表单”的发布数据发送 application/x-www-form-urlencoded 请求,而不是使用正确的 json 对象发送 application/json 。
Because you send application/x-www-form-urlencoded request with "form-like" post data instead of application/json with correct json object.