Beispiel #1
0
		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,
			});
		}
Beispiel #2
0
 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,
                                        });
     }
 }