private static void HandleIndexDisabledException(IHttpContext ctx, IndexDisabledException e) { ctx.Response.StatusCode = 503; ctx.Response.StatusDescription = "Service Unavailable"; SerializeError(ctx, new { Url = ctx.Request.RawUrl, Error = e.Information.GetErrorMessage(), Index = e.Information.Name, }); }
private static void HandleIndexDisabledException(HttpListenerContext ctx, IndexDisabledException e) { ctx.Response.StatusCode = 503; ctx.Response.StatusDescription = "Service Unavailable"; using (var sw = new StreamWriter(ctx.Response.OutputStream)) { new JsonSerializer().Serialize(sw, new { url = ctx.Request.RawUrl, error = e.Information.GetErrorMessage(), index = e.Information.Name, }); } }