protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
 {
     if (MaintenanceMode.IsEnabledForHttpMethod(request.Method.Method))
     {
         return(request.CreateResponse(HttpStatusCode.ServiceUnavailable));
     }
     return(await base.SendAsync(request, cancellationToken));
 }
示例#2
0
 public async Task InvokeAsync(HttpContext context)
 {
     if (MaintenanceMode.IsEnabledForHttpMethod(context.Request.Method))
     {
         context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
         return;
     }
     await _next(context);
 }