Using Joyrock requires referencing the Jayrock.dll,jayrock.json.dll two file, plus the introduction of json.js files in the Web page (json.js not available in the same place),
. NET Background files
Using system;using system.collections.generic;using system.linq;using system.web;using Jayrock.Json;using Jayrock.jsonrpc;using jayrock.jsonrpc.web;namespace exam.jayrock{public class Handler1:jsonrpchandler {// /<summary>//without parameters///</summary>//<returns></returns> [JSONRPCME Thod ("Getstring1")] public string getstring1 () {return String.Format ("Welcome-Jayrock by {0}! ", DateTime.Now); }///<summary>//with parameters///</summary>//<param name= "str" >the string.< /param>//<returns></returns> [Jsonrpcmethod ("Getstring2")] public string getstring2 (String str) {return String.Format ("Welcome to Jayrock by {0}!", str); } [Jsonrpcmethod ("addentity")] public int addentity (Jsonobject ent) {New Entity ("Demo"). A Ddentity (ENT); return 1; } [Jsonrpcmethod ("updateentity")] public int updateentity (Jsonobject ent) {new Entity ("Demo"). updateentity (ENT); return 1; } [Jsonrpcmethod ("delentity")] public int delentity (int id) {New Entity ("Demo"). delentity (ID); return 1; } [Jsonrpcmethod ("Getentitylist")] public list<jsonobject> getentitylist (string where) { return new Entity ("Demo"). Getentitylist (where); } }}
Foreground call page
ASP. Joyrock Asynchronous Application example, Json-rpc use method