2011-11-16 24 views
1

我想弄清楚我在做一個簡單的Jayrock JSON-RPC服務有什麼問題。Jayrock:網絡方法未導出

基本上,我正在爲.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"] 

回答

0

類屬性應該使用:

[JsonRpcService("Handler")] 
public class Handler : JsonRpcHandler, IRequiresSessionState