Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

interface Microsoft.​Extensions.​Hosting.​IHost

Assembly: Microsoft.Extensions.Hosting.Abstractions

Implemented Interfaces

A program abstraction.

Properties

Gets the services configured for the program (for example, using <see cref="M:Microsoft.Extensions.Hosting.IHostBuilder.ConfigureServices(System.Action{Microsoft.Extensions.Hosting.HostBuilderContext,Microsoft.Extensions.DependencyInjection.IServiceCollection})" /> ).

Methods

StartAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Starts the <see cref="T:Microsoft.Extensions.Hosting.IHostedService" /> objects configured for the program. The application will run until interrupted or until <see cref="M:Microsoft.Extensions.Hosting.IHostApplicationLifetime.StopApplication" /> is called.
Returns A <see cref="T:System.Threading.Tasks.Task" /> that will be completed when the <see cref="T:Microsoft.Extensions.Hosting.IHost" /> starts.
cancellationToken Used to abort program start.
StopAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Attempts to gracefully stop the program.
Returns A <see cref="T:System.Threading.Tasks.Task" /> that will be completed when the <see cref="T:Microsoft.Extensions.Hosting.IHost" /> stops.
cancellationToken Used to indicate when stop should no longer be graceful.