WebApplication Class

Definition

The web application used to configure the HTTP pipeline, and routes.

public sealed class WebApplication : IAsyncDisposable, IDisposable, Microsoft.AspNetCore.Builder.IApplicationBuilder, Microsoft.AspNetCore.Routing.IEndpointRouteBuilder, Microsoft.Extensions.Hosting.IHost
type WebApplication = class
    interface IHost
    interface IDisposable
    interface IApplicationBuilder
    interface IEndpointRouteBuilder
    interface IAsyncDisposable
Public NotInheritable Class WebApplication
Implements IApplicationBuilder, IAsyncDisposable, IDisposable, IEndpointRouteBuilder, IHost
Inheritance
WebApplication
Implements

Properties

Configuration

The application's configured IConfiguration.

Environment

The application's configured IWebHostEnvironment.

Lifetime

Allows consumers to be notified of application lifetime events.

Logger

The default logger for the application.

Services

The application's configured services.

Urls

The list of URLs that the HTTP server is bound to.

Methods

Create(String[])

Initializes a new instance of the WebApplication class with preconfigured defaults.

CreateBuilder()

Initializes a new instance of the WebApplicationBuilder class with preconfigured defaults.

CreateBuilder(String[])

Initializes a new instance of the WebApplicationBuilder class with preconfigured defaults.

CreateBuilder(WebApplicationOptions)

Initializes a new instance of the WebApplicationBuilder class with preconfigured defaults.

DisposeAsync()

Disposes the application.

Run(String)

Runs an application and block the calling thread until host shutdown.

RunAsync(String)

Runs an application and returns a Task that only completes when the token is triggered or shutdown is triggered.

StartAsync(CancellationToken)

Start the application.

StopAsync(CancellationToken)

Shuts down the application.

Explicit Interface Implementations

IApplicationBuilder.ApplicationServices
IApplicationBuilder.Build()
IApplicationBuilder.New()
IApplicationBuilder.Properties
IApplicationBuilder.ServerFeatures
IApplicationBuilder.Use(Func<RequestDelegate,RequestDelegate>)
IDisposable.Dispose()

Disposes the application.

IEndpointRouteBuilder.CreateApplicationBuilder()
IEndpointRouteBuilder.DataSources
IEndpointRouteBuilder.ServiceProvider

Extension Methods

UseRequestLocalization(IApplicationBuilder)

Adds the RequestLocalizationMiddleware to automatically set culture information for requests based on information provided by the client.

UseRequestLocalization(IApplicationBuilder, RequestLocalizationOptions)

Adds the RequestLocalizationMiddleware to automatically set culture information for requests based on information provided by the client.

UseRequestLocalization(IApplicationBuilder, Action<RequestLocalizationOptions>)

Adds the RequestLocalizationMiddleware to automatically set culture information for requests based on information provided by the client.

UseRequestLocalization(IApplicationBuilder, String[])

Adds the RequestLocalizationMiddleware to automatically set culture information for requests based on information provided by the client.

UseAuthentication(IApplicationBuilder)

Adds the AuthenticationMiddleware to the specified IApplicationBuilder, which enables authentication capabilities.

UseAuthorization(IApplicationBuilder)

Adds the AuthorizationMiddleware to the specified IApplicationBuilder, which enables authorization capabilities.

When authorizing a resource that is routed using endpoint routing, this call must appear between the calls to app.UseRouting() and app.UseEndpoints(...) for the middleware to function correctly.

UseCertificateForwarding(IApplicationBuilder)

Adds a middleware to the pipeline that will look for a certificate in a request header decode it, and updates HttpContext.Connection.ClientCertificate.

MapBlazorHub(IEndpointRouteBuilder)

Maps the Blazor Hub to the default path.

MapBlazorHub(IEndpointRouteBuilder, Action<HttpConnectionDispatcherOptions>)

Maps the Blazor Hub to the default path.

MapBlazorHub(IEndpointRouteBuilder, String)

Maps the Blazor Hub to the path path.

MapBlazorHub(IEndpointRouteBuilder, String, Action<HttpConnectionDispatcherOptions>)

Maps the Blazor Hub to the path path.

UseBlazorFrameworkFiles(IApplicationBuilder)

Configures the application to serve Blazor WebAssembly framework files from the root path "/".

UseBlazorFrameworkFiles(IApplicationBuilder, PathString)

Configures the application to serve Blazor WebAssembly framework files from the path pathPrefix. This path must correspond to a referenced Blazor WebAssembly application project.

UseConcurrencyLimiter(IApplicationBuilder)

Adds the ConcurrencyLimiterMiddleware to limit the number of concurrently-executing requests.

MapConnectionHandler<TConnectionHandler>(IEndpointRouteBuilder, String)

Maps incoming requests with the specified path to the provided connection pipeline.

MapConnectionHandler<TConnectionHandler>(IEndpointRouteBuilder, String, Action<HttpConnectionDispatcherOptions>)

Maps incoming requests with the specified path to the provided connection pipeline.

MapConnections(IEndpointRouteBuilder, String, HttpConnectionDispatcherOptions, Action<IConnectionBuilder>)

Maps incoming requests with the specified path to the provided connection pipeline.

MapConnections(IEndpointRouteBuilder, String, Action<IConnectionBuilder>)

Maps incoming requests with the specified path to the provided connection pipeline.

MapAreaControllerRoute(IEndpointRouteBuilder, String, String, String, Object, Object, Object)

Adds endpoints for controller actions to the IEndpointRouteBuilder and specifies a route with the given name, areaName, pattern, defaults, constraints, and dataTokens.

MapControllerRoute(IEndpointRouteBuilder, String, String, Object, Object, Object)

Adds endpoints for controller actions to the IEndpointRouteBuilder and specifies a route with the given name, pattern, defaults, constraints, and dataTokens.

MapControllers(IEndpointRouteBuilder)

Adds endpoints for controller actions to the IEndpointRouteBuilder without specifying any routes.

MapDefaultControllerRoute(IEndpointRouteBuilder)

Adds endpoints for controller actions to the IEndpointRouteBuilder and adds the default route {controller=Home}/{action=Index}/{id?}.

MapDynamicControllerRoute<TTransformer>(IEndpointRouteBuilder, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will attempt to select a controller action using the route values produced by TTransformer.

MapDynamicControllerRoute<TTransformer>(IEndpointRouteBuilder, String, Object)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will attempt to select a controller action using the route values produced by TTransformer.

MapDynamicControllerRoute<TTransformer>(IEndpointRouteBuilder, String, Object, Int32)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will attempt to select a controller action using the route values produced by TTransformer.

MapFallbackToAreaController(IEndpointRouteBuilder, String, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority. The request will be routed to a controller endpoint that matches action, controller, and area.

MapFallbackToAreaController(IEndpointRouteBuilder, String, String, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority. The request will be routed to a controller endpoint that matches action, controller, and area.

MapFallbackToController(IEndpointRouteBuilder, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority. The request will be routed to a controller endpoint that matches action, and controller.

MapFallbackToController(IEndpointRouteBuilder, String, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority. The request will be routed to a controller endpoint that matches action, and controller.

UseCookiePolicy(IApplicationBuilder)

Adds the CookiePolicyMiddleware handler to the specified IApplicationBuilder, which enables cookie policy capabilities.

UseCookiePolicy(IApplicationBuilder, CookiePolicyOptions)

Adds the CookiePolicyMiddleware handler to the specified IApplicationBuilder, which enables cookie policy capabilities.

UseCors(IApplicationBuilder)

Adds a CORS middleware to your web application pipeline to allow cross domain requests.

UseCors(IApplicationBuilder, Action<CorsPolicyBuilder>)

Adds a CORS middleware to your web application pipeline to allow cross domain requests.

UseCors(IApplicationBuilder, String)

Adds a CORS middleware to your web application pipeline to allow cross domain requests.

UseDatabaseErrorPage(IApplicationBuilder)
Obsolete.

Captures synchronous and asynchronous database related exceptions from the pipeline that may be resolved using Entity Framework migrations. When these exceptions occur, an HTML response with details of possible actions to resolve the issue is generated.

UseDatabaseErrorPage(IApplicationBuilder, DatabaseErrorPageOptions)
Obsolete.

Captures synchronous and asynchronous database related exceptions from the pipeline that may be resolved using Entity Framework migrations. When these exceptions occur, an HTML response with details of possible actions to resolve the issue is generated.

UseDefaultFiles(IApplicationBuilder)

Enables default file mapping on the current path

UseDefaultFiles(IApplicationBuilder, DefaultFilesOptions)

Enables default file mapping with the given options

UseDefaultFiles(IApplicationBuilder, String)

Enables default file mapping for the given request path

UseDeveloperExceptionPage(IApplicationBuilder)

Captures synchronous and asynchronous Exception instances from the pipeline and generates HTML error responses.

UseDeveloperExceptionPage(IApplicationBuilder, DeveloperExceptionPageOptions)

Captures synchronous and asynchronous Exception instances from the pipeline and generates HTML error responses.

UseDirectoryBrowser(IApplicationBuilder)

Enable directory browsing on the current path

UseDirectoryBrowser(IApplicationBuilder, DirectoryBrowserOptions)

Enable directory browsing with the given options

UseDirectoryBrowser(IApplicationBuilder, String)

Enables directory browsing for the given request path

Map(IEndpointRouteBuilder, RoutePattern, RequestDelegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified pattern.

Map(IEndpointRouteBuilder, RoutePattern, Delegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified pattern.

Map(IEndpointRouteBuilder, String, RequestDelegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified pattern.

Map(IEndpointRouteBuilder, String, Delegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified pattern.

MapDelete(IEndpointRouteBuilder, String, RequestDelegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP DELETE requests for the specified pattern.

MapDelete(IEndpointRouteBuilder, String, Delegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP DELETE requests for the specified pattern.

MapFallback(IEndpointRouteBuilder, Delegate)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority.

MapFallback(IEndpointRouteBuilder, String, Delegate)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match the provided pattern with the lowest possible priority.

MapGet(IEndpointRouteBuilder, String, RequestDelegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP GET requests for the specified pattern.

MapGet(IEndpointRouteBuilder, String, Delegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP GET requests for the specified pattern.

MapMethods(IEndpointRouteBuilder, String, IEnumerable<String>, RequestDelegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified HTTP methods and pattern.

MapMethods(IEndpointRouteBuilder, String, IEnumerable<String>, Delegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified HTTP methods and pattern.

MapPost(IEndpointRouteBuilder, String, RequestDelegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP POST requests for the specified pattern.

MapPost(IEndpointRouteBuilder, String, Delegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP POST requests for the specified pattern.

MapPut(IEndpointRouteBuilder, String, RequestDelegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP PUT requests for the specified pattern.

MapPut(IEndpointRouteBuilder, String, Delegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP PUT requests for the specified pattern.

UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>)

Adds a Microsoft.AspNetCore.Routing.EndpointMiddleware middleware to the specified IApplicationBuilder with the EndpointDataSource instances built from configured IEndpointRouteBuilder. The Microsoft.AspNetCore.Routing.EndpointMiddleware will execute the Endpoint associated with the current request.

UseRouting(IApplicationBuilder)

Adds a Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware middleware to the specified IApplicationBuilder.

UseExceptionHandler(IApplicationBuilder)

Adds a middleware to the pipeline that will catch exceptions, log them, and re-execute the request in an alternate pipeline. The request will not be re-executed if the response has already started.

UseExceptionHandler(IApplicationBuilder, ExceptionHandlerOptions)

Adds a middleware to the pipeline that will catch exceptions, log them, and re-execute the request in an alternate pipeline. The request will not be re-executed if the response has already started.

UseExceptionHandler(IApplicationBuilder, Action<IApplicationBuilder>)

Adds a middleware to the pipeline that will catch exceptions, log them, and re-execute the request in an alternate pipeline. The request will not be re-executed if the response has already started.

UseExceptionHandler(IApplicationBuilder, String)

Adds a middleware to the pipeline that will catch exceptions, log them, reset the request path, and re-execute the request. The request will not be re-executed if the response has already started.

MapFallback(IEndpointRouteBuilder, RequestDelegate)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority.

MapFallback(IEndpointRouteBuilder, String, RequestDelegate)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match the provided pattern with the lowest possible priority.

UseFileServer(IApplicationBuilder)

Enable all static file middleware (except directory browsing) for the current request path in the current directory.

UseFileServer(IApplicationBuilder, FileServerOptions)

Enable all static file middleware with the given options

UseFileServer(IApplicationBuilder, Boolean)

Enable all static file middleware on for the current request path in the current directory.

UseFileServer(IApplicationBuilder, String)

Enables all static file middleware (except directory browsing) for the given request path from the directory of the same name

UseForwardedHeaders(IApplicationBuilder)

Applies forwarded headers to their matching fields on the current request.

By convention, HTTP proxies forward information from the client in well-known HTTP headers. The ForwardedHeadersMiddleware reads these headers and fills in the associated fields on HttpContext.

UseForwardedHeaders(IApplicationBuilder, ForwardedHeadersOptions)

Applies forwarded headers to their matching fields on the current request.

By convention, HTTP proxies forward information from the client in well-known HTTP headers. The ForwardedHeadersMiddleware reads these headers and fills in the associated fields on HttpContext.

UseHeaderPropagation(IApplicationBuilder)

Adds a middleware that collect headers to be propagated to a HttpClient.

UseHealthChecks(IApplicationBuilder, PathString)

Adds a middleware that provides health check status.

UseHealthChecks(IApplicationBuilder, PathString, HealthCheckOptions)

Adds a middleware that provides health check status.

UseHealthChecks(IApplicationBuilder, PathString, Int32)

Adds a middleware that provides health check status.

UseHealthChecks(IApplicationBuilder, PathString, Int32, HealthCheckOptions)

Adds a middleware that provides health check status.

UseHealthChecks(IApplicationBuilder, PathString, String)

Adds a middleware that provides health check status.

UseHealthChecks(IApplicationBuilder, PathString, String, HealthCheckOptions)

Adds a middleware that provides health check status.

MapHealthChecks(IEndpointRouteBuilder, String)

Adds a health checks endpoint to the IEndpointRouteBuilder with the specified template.

MapHealthChecks(IEndpointRouteBuilder, String, HealthCheckOptions)

Adds a health checks endpoint to the IEndpointRouteBuilder with the specified template and options.

UseHostFiltering(IApplicationBuilder)

Adds middleware for filtering requests by allowed host headers. Invalid requests will be rejected with a 400 status code.

UseHsts(IApplicationBuilder)

Adds middleware for using HSTS, which adds the Strict-Transport-Security header.

UseHttpLogging(IApplicationBuilder)

Adds a middleware that can log HTTP requests and responses.

UseW3CLogging(IApplicationBuilder)

Adds a middleware that can log HTTP requests and responses for server logs in W3C format.

UseHttpMethodOverride(IApplicationBuilder)

Allows incoming POST request to override method type with type specified in header. This middleware is used when a client is limited to sending GET or POST methods but wants to invoke other HTTP methods. By default, the X-HTTP-Method-Override request header is used to specify the HTTP method being tunneled.

UseHttpMethodOverride(IApplicationBuilder, HttpMethodOverrideOptions)

Allows incoming POST request to override method type with type specified in form. This middleware is used when a client is limited to sending GET or POST methods but wants to invoke other HTTP methods.

UseHttpsRedirection(IApplicationBuilder)

Adds middleware for redirecting HTTP Requests to HTTPS.

MapHub<THub>(IEndpointRouteBuilder, String)

Maps incoming requests with the specified path to the specified Hub type.

MapHub<THub>(IEndpointRouteBuilder, String, Action<HttpConnectionDispatcherOptions>)

Maps incoming requests with the specified path to the specified Hub type.

Map(IApplicationBuilder, PathString, Action<IApplicationBuilder>)

Branches the request pipeline based on matches of the given request path. If the request path starts with the given path, the branch is executed.

Map(IApplicationBuilder, PathString, Boolean, Action<IApplicationBuilder>)

Branches the request pipeline based on matches of the given request path. If the request path starts with the given path, the branch is executed.

Map(IApplicationBuilder, String, Action<IApplicationBuilder>)

Branches the request pipeline based on matches of the given request path. If the request path starts with the given path, the branch is executed.

MapWhen(IApplicationBuilder, Func<HttpContext,Boolean>, Action<IApplicationBuilder>)

Branches the request pipeline based on the result of the given predicate.

UseMigrationsEndPoint(IApplicationBuilder)

Processes requests to execute migrations operations. The middleware will listen for requests made to DefaultPath.

UseMigrationsEndPoint(IApplicationBuilder, MigrationsEndPointOptions)

Processes requests to execute migrations operations. The middleware will listen for requests to the path configured in options.

UseMvc(IApplicationBuilder)

Adds MVC to the IApplicationBuilder request execution pipeline.

UseMvc(IApplicationBuilder, Action<IRouteBuilder>)

Adds MVC to the IApplicationBuilder request execution pipeline.

UseMvcWithDefaultRoute(IApplicationBuilder)

Adds MVC to the IApplicationBuilder request execution pipeline with a default route named 'default' and the following template: '{controller=Home}/{action=Index}/{id?}'.

UseOwin(IApplicationBuilder)

Adds an OWIN pipeline to the specified IApplicationBuilder.

UseOwin(IApplicationBuilder, Action<Action<Func<Func<IDictionary<String,Object>,Task>,Func<IDictionary<String,Object>,Task>>>>)

Adds OWIN middleware pipeline to the specified IApplicationBuilder.

MapDynamicPageRoute<TTransformer>(IEndpointRouteBuilder, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will attempt to select a page using the route values produced by TTransformer.

MapDynamicPageRoute<TTransformer>(IEndpointRouteBuilder, String, Object)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will attempt to select a page using the route values produced by TTransformer.

MapDynamicPageRoute<TTransformer>(IEndpointRouteBuilder, String, Object, Int32)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will attempt to select a page using the route values produced by TTransformer.

MapFallbackToAreaPage(IEndpointRouteBuilder, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority. The request will be routed to a page endpoint that matches page, and area.

MapFallbackToAreaPage(IEndpointRouteBuilder, String, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority. The request will be routed to a page endpoint that matches page, and area.

MapFallbackToPage(IEndpointRouteBuilder, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority. The request will be routed to a page endpoint that matches page.

MapFallbackToPage(IEndpointRouteBuilder, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority. The request will be routed to a page endpoint that matches page.

MapRazorPages(IEndpointRouteBuilder)

Adds endpoints for Razor Pages to the IEndpointRouteBuilder.

UseResponseCaching(IApplicationBuilder)

Adds the ResponseCachingMiddleware for caching HTTP responses.

UseResponseCompression(IApplicationBuilder)

Adds middleware for dynamically compressing HTTP Responses.

UseRewriter(IApplicationBuilder)

Checks if a given Url matches rules and conditions, and modifies the HttpContext on match.

UseRewriter(IApplicationBuilder, RewriteOptions)

Checks if a given Url matches rules and conditions, and modifies the HttpContext on match.

UseRouter(IApplicationBuilder, IRouter)

Adds a RouterMiddleware middleware to the specified IApplicationBuilder with the specified IRouter.

UseRouter(IApplicationBuilder, Action<IRouteBuilder>)

Adds a RouterMiddleware middleware to the specified IApplicationBuilder with the IRouter built from configured IRouteBuilder.

Run(IApplicationBuilder, RequestDelegate)

Adds a terminal middleware delegate to the application's request pipeline.

UseSession(IApplicationBuilder)

Adds the SessionMiddleware to automatically enable session state for the application.

UseSession(IApplicationBuilder, SessionOptions)

Adds the SessionMiddleware to automatically enable session state for the application.

UseSpa(IApplicationBuilder, Action<ISpaBuilder>)

Handles all requests from this point in the middleware chain by returning the default page for the Single Page Application (SPA).

This middleware should be placed late in the chain, so that other middleware for serving static files, MVC actions, etc., takes precedence.

UseStaticFiles(IApplicationBuilder)

Enables static file serving for the current request path

UseStaticFiles(IApplicationBuilder, StaticFileOptions)

Enables static file serving with the given options

UseStaticFiles(IApplicationBuilder, String)

Enables static file serving for the given request path

MapFallbackToFile(IEndpointRouteBuilder, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

MapFallbackToFile(IEndpointRouteBuilder, String, StaticFileOptions)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

MapFallbackToFile(IEndpointRouteBuilder, String, String)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

MapFallbackToFile(IEndpointRouteBuilder, String, String, StaticFileOptions)

Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-filenames with the lowest possible priority. The request will be routed to a StaticFileMiddleware that attempts to serve the file specified by filePath.

UseStatusCodePages(IApplicationBuilder)

Adds a StatusCodePages middleware with a default response handler that checks for responses with status codes between 400 and 599 that do not have a body.

UseStatusCodePages(IApplicationBuilder, StatusCodePagesOptions)

Adds a StatusCodePages middleware with the given options that checks for responses with status codes between 400 and 599 that do not have a body.

UseStatusCodePages(IApplicationBuilder, Action<IApplicationBuilder>)

Adds a StatusCodePages middleware to the pipeline with the specified alternate middleware pipeline to execute to generate the response body.

UseStatusCodePages(IApplicationBuilder, Func<StatusCodeContext,Task>)

Adds a StatusCodePages middleware with the specified handler that checks for responses with status codes between 400 and 599 that do not have a body.

UseStatusCodePages(IApplicationBuilder, String, String)

Adds a StatusCodePages middleware with the specified response body to send. This may include a '{0}' placeholder for the status code. The middleware checks for responses with status codes between 400 and 599 that do not have a body.

UseStatusCodePagesWithRedirects(IApplicationBuilder, String)

Adds a StatusCodePages middleware to the pipeline. Specifies that responses should be handled by redirecting with the given location URL template. This may include a '{0}' placeholder for the status code. URLs starting with '~' will have PathBase prepended, where any other URL will be used as is.

UseStatusCodePagesWithReExecute(IApplicationBuilder, String, String)

Adds a StatusCodePages middleware to the pipeline. Specifies that the response body should be generated by re-executing the request pipeline using an alternate path. This path may contain a '{0}' placeholder of the status code.

Use(IApplicationBuilder, Func<HttpContext,RequestDelegate,Task>)

Adds a middleware delegate defined in-line to the application's request pipeline. If you aren't calling the next function, use Run(IApplicationBuilder, RequestDelegate) instead.

Use(IApplicationBuilder, Func<HttpContext,Func<Task>,Task>)

Adds a middleware delegate defined in-line to the application's request pipeline. If you aren't calling the next function, use Run(IApplicationBuilder, RequestDelegate) instead.

Prefer using Use(IApplicationBuilder, Func<HttpContext,RequestDelegate,Task>) for better performance as shown below:

app.Use((context, next) =>
{
    return next(context);
});

UseMiddleware(IApplicationBuilder, Type, Object[])

Adds a middleware type to the application's request pipeline.

UseMiddleware<TMiddleware>(IApplicationBuilder, Object[])

Adds a middleware type to the application's request pipeline.

UsePathBase(IApplicationBuilder, PathString)

Adds a middleware that extracts the specified path base from request path and postpend it to the request path base.

UseWhen(IApplicationBuilder, Func<HttpContext,Boolean>, Action<IApplicationBuilder>)

Conditionally creates a branch in the request pipeline that is rejoined to the main pipeline.

UseWebAssemblyDebugging(IApplicationBuilder)

Adds middleware needed for debugging Blazor WebAssembly applications inside Chromium dev tools.

UseWebSockets(IApplicationBuilder)

Adds the WebSocketMiddleware to the request pipeline.

UseWebSockets(IApplicationBuilder, WebSocketOptions)

Adds the WebSocketMiddleware to the request pipeline.

UseWelcomePage(IApplicationBuilder)

Adds the WelcomePageMiddleware to the pipeline.

UseWelcomePage(IApplicationBuilder, WelcomePageOptions)

Adds the WelcomePageMiddleware to the pipeline with the given options.

UseWelcomePage(IApplicationBuilder, PathString)

Adds the WelcomePageMiddleware to the pipeline with the given path.

UseWelcomePage(IApplicationBuilder, String)

Adds the WelcomePageMiddleware to the pipeline with the given path.

UseSpaStaticFiles(IApplicationBuilder)

Configures the application to serve static files for a Single Page Application (SPA). The files will be located using the registered ISpaStaticFileProvider service.

UseSpaStaticFiles(IApplicationBuilder, StaticFileOptions)

Configures the application to serve static files for a Single Page Application (SPA). The files will be located using the registered ISpaStaticFileProvider service.

Applies to