我试图弄清楚我在使用简单的 Jayrock JSON-RPC 服务时做错了什么。
基本上,我正在为 .NET WCF Web 服务编写 JSON 代理,以便 iPhone 可以使用它。SOAP 服务接口正在工作,所以我只是在我的 Jayrock 处理程序中实现一个服务实例并调用相应的方法。
不幸的是,虽然我的测试项目没有任何问题,但当我使用实际应用程序执行此操作时,我标记为 JsonRpcMethod 的 Jayrock Web 方法都没有导出。我所看到的只是 3 种默认方法。
我断开了所有其他方法,以防有一些干扰,我仍然没有看到任何东西。关于我可能做错什么的任何建议?
这是我的通用处理程序代码:
using System;
using System.Web;
using Jayrock.Json;
using Jayrock.JsonRpc;
using Jayrock.JsonRpc.Web;
using WimotiDTO.DataContract;
namespace WimotiWS
{
/// <summary>
/// Summary description for JSONEndpoint
/// This class implement a JSon proxy for the Wimoti web service
/// </summary>
public class JSONEndpoint : JsonRpcHandler
{
[JsonRpcMethod("Test")]
string Test()
{
return "Yeeha!";
}
}
}
这是页面:
<%@ WebHandler Language="C#" CodeBehind="JSONEndpoint.ashx.cs" Class="WimotiWS.JSONEndpoint"%>
最后,调用方法列表方法返回:
["system.listMethods","system.version","system.about"]