Namespace Microsoft.AspNetCore.Builder

Namespace: Microsoft.AspNetCore.Builder

Provides types that allow you to configure the HTTP request pipeline for an ASP.NET Core application.

Classes

WebApplicationBuilder

public class WebApplicationBuilder

Represents a builder that configures an WebApplication.

This class is used to set up the application's services, host configuration, and request pipeline.

IApplicationBuilder

public interface IApplicationBuilder

Defines members that enable application developer to configure an application's HTTP request pipeline.

Implementations of this interface are cast to the appropriate type for the application framework.

Interfaces

IEndpointRouteBuilder

public interface IEndpointRouteBuilder : IApplicationBuilder

Defines members that enable application developer to configure an application's endpoint routing.

This interface extends IApplicationBuilder and adds support for defining endpoints.

Types

WebApplication

public class WebApplication : IApplicationBuilder, IEndpointRouteBuilder, IDisposable

Represents an ASP.NET Core application.

This class provides a unified API for configuring and running an ASP.NET Core application, including services, host, and the request pipeline.

Methods

Use

public IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware)

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

Middleware delegates are executed in the order they are added.

Run

public void Run(RequestDelegate next)

Runs the given request delegate as the last piece of middleware in the pipeline.

This method is typically called at the end of the pipeline configuration to start the server.

Map

public IApplicationBuilder Map(string pathMatch, Action<IApplicationBuilder> applicationBuilder)

Branches the middleware pipeline based on a request path.

This allows for different pipelines to be executed for different URL prefixes.

Properties

ServerFeatures

public ICollection<KeyValuePair<Type, object>> ServerFeatures { get; }

Gets a collection of features for the server that is hosting the application.

Properties

public IDictionary<string, object> Properties { get; }

Gets a dictionary containing arbitrary properties that can be used to share data between middleware.

ApplicationServices

public IServiceProvider ApplicationServices { get; set; }

Gets or sets the IServiceProvider for the application.

See Also