public HttpResponseMessage Log(LogRequest logRequest) { var context = new HttpContextWrapper(HttpContext.Current); try { _requestProcessor.Process(new HttpContextWrapper(HttpContext.Current), logRequest); return(Request.CreateResponse(HttpStatusCode.NoContent)); } catch (System.Exception ex) { GC.KeepAlive(ex); #if DEBUG Gibraltar.Agent.Log.Write(LogMessageSeverity.Critical, Constants.LogSystem, 0, ex, LogWriteMode.Queued, context.StandardXmlRequestBlock(Request.Content.ReadAsStringAsync().Result), Constants.Category, "Unable to process message due to " + ex.GetType(), "Exception caught in top level catch block, this should have be caught by error handler specific to the part of the request processing that failed."); #endif } return(Request.CreateResponse(HttpStatusCode.InternalServerError)); }