Skip to content

AddMaintenanceMode ​

Binds MaintenanceSettings from the Maintenance configuration section and registers the file-backed store behind IMaintenanceService.

Call it during startup, before resolving IMaintenanceService or adding the middleware. The Maintenance section is optional.

Usage ​

csharp
using AlmightyShogun.AspNet.MaintenanceMode;

builder.Services.AddMaintenanceMode(builder.Configuration);

WARNING

This does not register the shared error response writer. Call AddHttpErrorResponseWriter as well, or the middleware cannot write the body a blocked request receives.

Parameters

configuration: IConfiguration
Application configuration that may contain the Maintenance section.

Returns

The same IServiceCollection instance with maintenance options and services registered.

Type signature ​

csharp
public IServiceCollection AddMaintenanceMode(
    IConfiguration configuration
);

All packages are released under the MIT License.