public HttpResponseMessage ExecuteRequest(HttpRequestMessage request) { if (Verbose) Console.WriteLine("Received {0} - {1}", request.Method, request.RequestUri); var routeData = determineRouteData(request); if (routeData == null) { return write404(); } else { try { var response = new HttpResponseMessage(HttpStatusCode.OK); var arguments = new SelfHostServiceArguments(routeData, request, response); var invoker = routeData.RouteHandler.As<FubuRouteHandler>().Invoker; var requestCompletion = new RequestCompletion(); requestCompletion.Start(() => invoker.Invoke(arguments, routeData.Values, requestCompletion)); arguments.Writer.AttachContent(); return response; } catch (Exception ex) { return write500(ex); } } }