Namespace: Microsoft.Extensions.Hosting
Assembly: Microsoft.Extensions.Hosting.Abstractions
Description: Provides types for creating and configuring a host for a .NET application, including dependency injection, configuration, logging, and lifetime management.
Defines the contract for a builder that configures services, application, and host.
The IHostBuilder interface is central to the .NET Generic Host. It provides methods to configure various aspects of the host, such as logging, dependency injection, configuration sources, and the application itself. The host is built using the Build() method.
Represents a .NET application host.
The IHost interface represents the configured and running application host. It provides access to the service provider and allows for starting and stopping the application gracefully. It also implements IDisposable for proper resource cleanup.
Provides information about the hosting environment.
The IHostEnvironment interface allows access to details about the current hosting environment, such as the application name, the content root path, and the environment name (e.g., 'Development', 'Staging', 'Production').
An implementation of IHostBuilder.
The HostBuilder class is the concrete implementation of IHostBuilder. It facilitates the process of configuring and building a IHost instance by chaining configuration methods.
An implementation of IHost.
The Host class is the concrete implementation of IHost. It manages the lifecycle of the application and its services.
Provides access to the application's lifetime events.
The HostApplicationLifetime class implements IHostApplicationLifetime, allowing components to gracefully handle application startup, shutdown, and cancellation requests.
Provides access to the application's lifetime events.
This interface defines events that can be used to monitor and control the application's lifecycle, including startup completion and graceful shutdown.
Extension methods for configuring the host configuration.
This static class provides extension methods to the IHostBuilder interface for configuring the host's configuration sources, such as command-line arguments and environment variables.
Extension methods for configuring the application configuration.
Allows for the configuration of the application's settings, including loading from various sources like JSON files, environment variables, and user secrets.
Extension methods for configuring the application services.
Used to register services in the dependency injection container, defining how the application's components interact.
Extension methods for setting host-specific settings.
Provides a way to customize the behavior and settings of the .NET host itself.