Microsoft.Extensions.Hosting 9.0.0
About
Contains the .NET Generic Host HostBuilder
which layers on the Microsoft.Extensions.Hosting.Abstractions
package.
Key Features
- Contains the .NET Generic Host
HostBuilder
.
How to Use
For a console app project:
using (IHost host = new HostBuilder().Build())
{
var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>();
lifetime.ApplicationStarted.Register(() =>
{
Console.WriteLine("Started");
});
lifetime.ApplicationStopping.Register(() =>
{
Console.WriteLine("Stopping firing");
Console.WriteLine("Stopping end");
});
lifetime.ApplicationStopped.Register(() =>
{
Console.WriteLine("Stopped firing");
Console.WriteLine("Stopped end");
});
host.Start();
// Listens for Ctrl+C.
host.WaitForShutdown();
}
Main Types
The main types provided by this library are:
Microsoft.Extensions.Host
.Microsoft.Extensions.Hosting.HostApplicationBuilder
Microsoft.Extensions.Hosting.HostBuilder
Microsoft.Extensions.Hosting.IHostedService
Microsoft.Extensions.Hosting.IHostedLifecycleService
Additional Documentation
- Generic host
- API documentation
Related Packages
Microsoft.Extensions.Configuration
Microsoft.Extensions.DependencyInjection
Microsoft.Extensions.Hosting.Abstractions
Microsoft.Extensions.Logging
Microsoft.Extensions.Options
Feedback & Contributing
Microsoft.Extensions.Hosting is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on Microsoft.Extensions.Hosting.
Packages | Downloads |
---|---|
Microsoft.ApplicationInsights.Kubernetes
Kubernetes support for .NET Core
|
31 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/d12868dd7c10ff0433c16b06d3b59d03c40d987a
|
30 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/cdfa43bbe0ecc13757cc6517c9a253de77c3ec56
|
29 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/c0ae1d179dba6f3acd0e55be55718c97c9028698
|
28 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/b7a2ec8c7ed6b48857af0a69688a73e8c14fe6cb
|
28 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/e0d900c8649d185cf925b59bc12187a116e5e114
|
28 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/3fe12b935c03138f76364dc877a7e069e254b5b2
|
27 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/c911002ab43b7b989ed67090f2a48d9073d5118d
|
26 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/50b7e9c661453874aa7a54a3985d5120564bb2e5
|
26 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/54142bcb25544b72fac28b1b061e7788c91c4f49
|
26 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/6a01dd1e69c8b9bd1ae005ea465ef2bcd26294bf
|
26 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/68bb6fb08f8f85bb3cf08953a0d2f4a254eaccff
|
26 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/718171eeb4bd236ab4f0d9b1ecd97ecc63ec0be1
|
26 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/3eeb12e106b9e913c3a4dec1a7d16da7b74149eb
|
25 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/fe4f0d09305ca73aa19976b4521e5c4e223b080e
|
25 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/860072f7781a10db10fa925ea5c86d91f1e6f2c4
|
25 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/617d594f2bf75a8904d3d0e7d68a0bacf8e6763a
|
25 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/32e8c8cae5b1a4dd752d0a42a6f8a2813f75f173
|
25 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/773e8cc3fbdc2c4ffbd57c1f53f21649ef94c35c
|
25 |
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/a5920c6656c9b8cef9e1f769c28062f0ade62f60
|
25 |
https://go.microsoft.com/fwlink/?LinkID=799421
.NET Framework 4.6.2
- Microsoft.Bcl.AsyncInterfaces (>= 9.0.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Logging.EventSource (>= 9.0.0)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0)
- Microsoft.Extensions.Logging.Debug (>= 9.0.0)
- Microsoft.Extensions.Logging.Console (>= 9.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Physical (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Diagnostics (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.UserSecrets (>= 9.0.0)
- Microsoft.Extensions.Configuration.Json (>= 9.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.0)
- Microsoft.Extensions.Configuration.CommandLine (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
.NET Standard 2.0
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Physical (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Diagnostics (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.UserSecrets (>= 9.0.0)
- Microsoft.Extensions.Configuration.Json (>= 9.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.0)
- Microsoft.Extensions.Configuration.CommandLine (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
- Microsoft.Bcl.AsyncInterfaces (>= 9.0.0)
- Microsoft.Extensions.Logging.Console (>= 9.0.0)
- Microsoft.Extensions.Logging.Debug (>= 9.0.0)
- Microsoft.Extensions.Logging.EventSource (>= 9.0.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0)
.NET 9.0
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Logging.EventSource (>= 9.0.0)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0)
- Microsoft.Extensions.Logging.Debug (>= 9.0.0)
- Microsoft.Extensions.Logging.Console (>= 9.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Physical (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.Diagnostics (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.UserSecrets (>= 9.0.0)
- Microsoft.Extensions.Configuration.Json (>= 9.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.0)
- Microsoft.Extensions.Configuration.CommandLine (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
.NET Standard 2.1
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Logging.EventSource (>= 9.0.0)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0)
- Microsoft.Extensions.Logging.Debug (>= 9.0.0)
- Microsoft.Extensions.Logging.Console (>= 9.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Physical (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Diagnostics (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.UserSecrets (>= 9.0.0)
- Microsoft.Extensions.Configuration.Json (>= 9.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.0)
- Microsoft.Extensions.Configuration.CommandLine (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
.NET 8.0
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.0)
- Microsoft.Extensions.Configuration.CommandLine (>= 9.0.0)
- Microsoft.Extensions.Configuration.Json (>= 9.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Logging.EventSource (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.Logging.Debug (>= 9.0.0)
- Microsoft.Extensions.Configuration.UserSecrets (>= 9.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.Diagnostics (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Physical (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- Microsoft.Extensions.Logging.Console (>= 9.0.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0)
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 5 | 11/13/2024 |
9.0.0-rc.2.24473.5 | 7 | 10/12/2024 |
9.0.0-rc.1.24431.7 | 12 | 09/11/2024 |
9.0.0-preview.7.24405.7 | 13 | 08/14/2024 |
9.0.0-preview.6.24327.7 | 10 | 07/11/2024 |
9.0.0-preview.5.24306.7 | 13 | 06/17/2024 |
9.0.0-preview.4.24266.19 | 11 | 05/29/2024 |
9.0.0-preview.3.24172.9 | 13 | 04/17/2024 |
9.0.0-preview.2.24128.5 | 15 | 03/17/2024 |
9.0.0-preview.1.24080.9 | 13 | 04/07/2024 |
8.0.1 | 7 | 10/14/2024 |
8.0.0 | 16 | 12/18/2023 |
8.0.0-rc.2.23479.6 | 11 | 04/09/2024 |
8.0.0-rc.1.23419.4 | 16 | 10/06/2023 |
8.0.0-preview.7.23375.6 | 16 | 09/01/2023 |
8.0.0-preview.6.23329.7 | 15 | 10/31/2023 |
8.0.0-preview.5.23280.8 | 15 | 09/18/2023 |
8.0.0-preview.4.23259.5 | 19 | 05/31/2023 |
8.0.0-preview.3.23174.8 | 19 | 05/31/2023 |
8.0.0-preview.2.23128.3 | 13 | 10/27/2023 |
8.0.0-preview.1.23110.8 | 19 | 05/31/2023 |
7.0.1 | 15 | 08/18/2023 |
7.0.0 | 14 | 08/18/2023 |
7.0.0-rc.2.22472.3 | 15 | 08/18/2023 |
7.0.0-rc.1.22426.10 | 19 | 07/05/2023 |
7.0.0-preview.7.22375.6 | 14 | 08/18/2023 |
7.0.0-preview.6.22324.4 | 14 | 08/18/2023 |
7.0.0-preview.5.22301.12 | 19 | 08/18/2023 |
7.0.0-preview.4.22229.4 | 12 | 08/18/2023 |
7.0.0-preview.3.22175.4 | 13 | 08/18/2023 |
7.0.0-preview.2.22152.2 | 15 | 08/18/2023 |
7.0.0-preview.1.22076.8 | 15 | 08/18/2023 |
6.0.2-mauipre.1.22102.15 | 13 | 08/18/2023 |
6.0.2-mauipre.1.22054.8 | 14 | 08/18/2023 |
6.0.1 | 16 | 08/18/2023 |
6.0.0 | 13 | 11/12/2021 |
6.0.0-rc.2.21480.5 | 15 | 06/24/2023 |
6.0.0-rc.1.21451.13 | 15 | 06/23/2023 |
6.0.0-preview.7.21377.19 | 15 | 08/18/2023 |
6.0.0-preview.6.21352.12 | 17 | 05/29/2023 |
6.0.0-preview.5.21301.5 | 17 | 08/18/2023 |
6.0.0-preview.4.21253.7 | 14 | 05/29/2023 |
6.0.0-preview.3.21201.4 | 14 | 05/29/2023 |
6.0.0-preview.2.21154.6 | 14 | 10/27/2023 |
6.0.0-preview.1.21102.12 | 17 | 06/23/2023 |
5.0.0 | 24 | 07/08/2021 |
5.0.0-rc.2.20475.5 | 17 | 08/18/2023 |
5.0.0-rc.1.20451.14 | 13 | 08/18/2023 |
5.0.0-preview.8.20407.11 | 18 | 05/30/2023 |
5.0.0-preview.7.20364.11 | 18 | 05/30/2023 |
5.0.0-preview.6.20305.6 | 22 | 05/29/2023 |
5.0.0-preview.5.20278.1 | 20 | 05/30/2023 |
5.0.0-preview.4.20251.6 | 18 | 05/29/2023 |
5.0.0-preview.3.20215.2 | 20 | 05/30/2023 |
5.0.0-preview.2.20160.3 | 19 | 05/30/2023 |
5.0.0-preview.1.20120.4 | 23 | 05/30/2023 |
3.1.32 | 14 | 05/31/2023 |
3.1.31 | 21 | 05/29/2023 |
3.1.30 | 19 | 05/29/2023 |
3.1.29 | 19 | 05/29/2023 |
3.1.28 | 17 | 05/29/2023 |
3.1.27 | 22 | 05/29/2023 |
3.1.26 | 17 | 05/29/2023 |
3.1.25 | 17 | 05/29/2023 |
3.1.24 | 17 | 05/29/2023 |
3.1.23 | 17 | 05/29/2023 |
3.1.22 | 20 | 05/29/2023 |
3.1.21 | 21 | 05/29/2023 |
3.1.20 | 18 | 05/29/2023 |
3.1.19 | 23 | 05/29/2023 |
3.1.18 | 22 | 05/29/2023 |
3.1.17 | 19 | 05/29/2023 |
3.1.16 | 22 | 05/29/2023 |
3.1.15 | 18 | 05/29/2023 |
3.1.14 | 21 | 05/29/2023 |
3.1.13 | 20 | 05/29/2023 |
3.1.12 | 17 | 05/29/2023 |
3.1.11 | 18 | 05/29/2023 |
3.1.10 | 16 | 05/29/2023 |
3.1.9 | 21 | 05/30/2023 |
3.1.8 | 15 | 05/30/2023 |
3.1.7 | 14 | 05/30/2023 |
3.1.6 | 17 | 05/29/2023 |
3.1.5 | 19 | 05/29/2023 |
3.1.4 | 16 | 05/31/2023 |
3.1.3 | 19 | 05/29/2023 |
3.1.2 | 19 | 05/29/2023 |
3.1.1 | 20 | 05/29/2023 |
3.1.0 | 19 | 02/19/2022 |
3.1.0-preview3.19553.2 | 14 | 05/29/2023 |
3.1.0-preview2.19525.4 | 17 | 05/29/2023 |
3.1.0-preview1.19506.1 | 20 | 05/29/2023 |
3.0.3 | 23 | 05/29/2023 |
3.0.2 | 22 | 05/29/2023 |
3.0.1 | 23 | 05/29/2023 |
3.0.0 | 16 | 05/29/2023 |
3.0.0-rc1.19456.10 | 17 | 05/29/2023 |
3.0.0-preview9.19423.4 | 18 | 05/29/2023 |
3.0.0-preview8.19405.4 | 17 | 05/29/2023 |
3.0.0-preview7.19362.4 | 18 | 05/29/2023 |
3.0.0-preview6.19304.6 | 16 | 05/29/2023 |
3.0.0-preview5.19227.9 | 15 | 05/29/2023 |
3.0.0-preview4.19216.2 | 15 | 05/29/2023 |
3.0.0-preview3.19153.1 | 14 | 09/30/2023 |
3.0.0-preview.19074.2 | 17 | 05/29/2023 |
3.0.0-preview.18572.1 | 18 | 11/01/2023 |
2.2.0 | 19 | 05/29/2023 |
2.2.0-preview3-35497 | 15 | 05/29/2023 |
2.2.0-preview2-35157 | 20 | 05/29/2023 |
2.2.0-preview1-35029 | 18 | 05/29/2023 |
2.1.1 | 25 | 05/29/2023 |
2.1.0 | 15 | 05/29/2023 |
2.1.0-rc1-final | 18 | 05/29/2023 |
2.1.0-preview2-final | 21 | 05/29/2023 |
2.1.0-preview1-final | 29 | 05/29/2023 |