I've been looking all around without finding a solution to this. I would like to implement a JSON-RPC server with WCF. I've found this http://jsonrpc2.codeplex.com/ but it does not use WCF and I have idea how to integrate it. Can someone gives me an hint on how to put everything together?
Thanks
EDIT: I've posted my source code here
A very basic implementation of the server side is now working, at least with a HTTP GET request. I'm trying to implement now a WCF Client for it but again I'm stuck :( I'll post a separate question on it.
I've written some blogs which show exactly how to do that - see the first one (which has a link to the others) at http://blogs.msdn.com/b/carlosfigueira/archive/2011/12/08/wcf-extensibility-transport-channels-request-channels-part-1.aspx.
Basically, you'll need to create a transport channel which will understand the protocol. In that transport you'll need to convert the input / output into WCF Message
objects (the basic block of the WCF stack). And you'll need to deliver the messages to the rest of the stack. You'll also need to write an operation selector to map the incoming RPC message to the operation in the service which will be called.
Another alternative would be to write the JSON-RPC on top of HTTP; in this case, you should use instead of a transport channel a set of message formatter (breaking down parameters), operation selector and possibly a message inspector as well for request / reply correlation.
来源:https://stackoverflow.com/questions/17963977/implement-json-rpc-in-wcf