Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

HostApplicationBuilder Class

Definition

Namespace:
Microsoft.Extensions.Hosting
Assembly:
Microsoft.Extensions.Hosting.dll
Package:
Microsoft.Extensions.Hosting v11.0.0-preview.5.26302.115
Source:
HostApplicationBuilder.cs
Source:
HostApplicationBuilder.cs
Source:
HostApplicationBuilder.cs
Source:
HostApplicationBuilder.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Represents a hosted applications and services builder that helps manage configuration, logging, lifetime, and more.

public ref class HostApplicationBuilder sealed : Microsoft::Extensions::Hosting::IHostApplicationBuilder
public sealed class HostApplicationBuilder : Microsoft.Extensions.Hosting.IHostApplicationBuilder
type HostApplicationBuilder = class
 interface IHostApplicationBuilder
Public NotInheritable Class HostApplicationBuilder
Implements IHostApplicationBuilder
Inheritance
HostApplicationBuilder
Implements

Constructors

Name Description
HostApplicationBuilder()

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

HostApplicationBuilder(HostApplicationBuilderSettings)

Initializes a new instance of the HostApplicationBuilder.

HostApplicationBuilder(String[])

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

Properties

Name Description
Configuration

Gets the set of key/value configuration properties.

Environment

Gets information about the hosting environment an application is running in.

Logging

Gets a collection of logging providers for the application to compose. This property is useful for adding new logging providers.

Metrics

Allows enabling metrics and directing their output.

Services

Gets a collection of services for the application to compose. This property is useful for adding user-provided or framework-provided services.

Methods

Name Description
Build()

Builds the host. This method can only be called once.

ConfigureContainer<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder>, Action<TContainerBuilder>)

Registers a IServiceProviderFactory<TContainerBuilder> instance to be used to create the IServiceProvider.

Explicit Interface Implementations

Name Description
IHostApplicationBuilder.Configuration

Gets the set of key/value configuration properties.

IHostApplicationBuilder.Properties

Gets a central location for sharing state between components during the host building process.

Applies to


Feedback

Was this page helpful?