Share via


WebHostExtensions Class

Definition

Caution

WebHostExtensions is obsolete. Use Host.CreateDefaultBuilder or WebApplication.CreateBuilder instead. For more information, visit https://aka.ms/aspnet/deprecate/008.

Contains extensions for managing the lifecycle of an IWebHost.

public ref class WebHostExtensions abstract sealed
public static class WebHostExtensions
[System.Obsolete("WebHostExtensions is obsolete. Use Host.CreateDefaultBuilder or WebApplication.CreateBuilder instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId="ASPDEPR008", UrlFormat="https://aka.ms/aspnet/deprecate/008")]
public static class WebHostExtensions
type WebHostExtensions = class
[<System.Obsolete("WebHostExtensions is obsolete. Use Host.CreateDefaultBuilder or WebApplication.CreateBuilder instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId="ASPDEPR008", UrlFormat="https://aka.ms/aspnet/deprecate/008")>]
type WebHostExtensions = class
Public Module WebHostExtensions
Inheritance
WebHostExtensions
Attributes

Methods

Name Description
Run(IWebHost, CancellationToken)

Runs a web application and block the calling thread until token is triggered or shutdown is triggered.

Run(IWebHost)

Runs a web application and block the calling thread until host shutdown.

RunAsync(IWebHost, CancellationToken)

Runs a web application and returns a Task that only completes when the token is triggered or shutdown is triggered.

StopAsync(IWebHost, TimeSpan)

Attempts to gracefully stop the host with the given timeout.

WaitForShutdown(IWebHost)

Block the calling thread until shutdown is triggered via Ctrl+C or SIGTERM.

WaitForShutdownAsync(IWebHost, CancellationToken)

Returns a Task that completes when shutdown is triggered via the given token, Ctrl+C or SIGTERM.

Applies to