WebApplicationBuilder Class

Definition

A builder for web applications and services.

C#
public sealed class WebApplicationBuilder
C#
public sealed class WebApplicationBuilder : Microsoft.Extensions.Hosting.IHostApplicationBuilder
Inheritance
WebApplicationBuilder
Implements

Properties

Configuration

A collection of configuration providers for the application to compose. This is useful for adding new configuration sources and providers.

Environment

Provides information about the web hosting environment an application is running.

Host

An IHostBuilder for configuring host specific properties, but not building. To build after configuration, call Build().

Logging

A collection of logging providers for the application to compose. This is useful for adding new logging providers.

Metrics

Allows enabling metrics and directing their output.

Services

A collection of services for the application to compose. This is useful for adding user provided or framework provided services.

WebHost

An IWebHostBuilder for configuring server specific properties, but not building. To build after configuration, call Build().

Methods

Build()

Builds the WebApplication.

Explicit Interface Implementations

Applies to

Product Versions
ASP.NET Core 6.0, 7.0, 8.0, 9.0