public static void ProcessRequest(IRpcService service, HttpContext httpContext)
        {
            if (service == null)
                throw new ArgumentNullException("service");

            if (httpContext == null)
                throw new ArgumentNullException("httpContext");

            //
            // Create a context to service the request and configure it.
            //

            RpcServiceContext context = new RpcServiceContext(service);

            //
            // Cross-connect the service and HTTP context so that one
            // can be found given the other.
            //
            
            context.ContextServices.AddService(typeof(HttpContext), httpContext);
            httpContext.Items.Add(typeof(RpcServiceContext), context);

            context.ContextServices.AddService(typeof(RpcServiceFeatureRegistry), RpcServiceFeatureRegistry.FromConfig());

            JsonRpcServiceWebBinder binder = new JsonRpcServiceWebBinder(context);
            IRpcServiceFeature feature = binder.Bind();

            IHttpHandler handler = feature as IHttpHandler;
        
            if (handler == null)
                throw new JsonRpcException(string.Format("The {0} feature does not support the HTTP protocol.", feature.GetType().FullName));

            handler.ProcessRequest(httpContext);
        }
        public JsonRpcServiceWebBinder(RpcServiceContext context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            _context = context;
        }
        private static HttpContext HttpContextFromServiceContext(RpcServiceContext context)
        {
            Debug.Assert(context != null);

            return (HttpContext) ServiceQuery.GetByType(context, typeof(HttpContext));
        }