WebHost WebHost WebHost Class

Definition

public class WebHost : IDisposable, Microsoft.AspNetCore.Hosting.IWebHost
type WebHost = class
    interface IWebHost
    interface IDisposable
Public Class WebHost
Implements IDisposable, IWebHost
Inheritance
WebHostWebHostWebHost
Implements

Constructors

WebHost(IServiceCollection, IServiceProvider, WebHostOptions, IConfiguration) WebHost(IServiceCollection, IServiceProvider, WebHostOptions, IConfiguration) WebHost(IServiceCollection, IServiceProvider, WebHostOptions, IConfiguration)

Properties

ServerFeatures ServerFeatures ServerFeatures
Services Services Services

Methods

Dispose() Dispose() Dispose()
Initialize() Initialize() Initialize()
Start() Start() Start()

Extension Methods

Run(IWebHost) Run(IWebHost) Run(IWebHost)

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

Run(IWebHost, CancellationToken) Run(IWebHost, CancellationToken) Run(IWebHost, CancellationToken)

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

RunAsync(IWebHost, CancellationToken) RunAsync(IWebHost, CancellationToken) 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) StopAsync(IWebHost, TimeSpan) StopAsync(IWebHost, TimeSpan)

Attempts to gracefully stop the host with the given timeout.

WaitForShutdown(IWebHost) WaitForShutdown(IWebHost) WaitForShutdown(IWebHost)

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

WaitForShutdownAsync(IWebHost, CancellationToken) WaitForShutdownAsync(IWebHost, CancellationToken) WaitForShutdownAsync(IWebHost, CancellationToken)

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

RunAsService(IWebHost) RunAsService(IWebHost) RunAsService(IWebHost)

Runs the specified web application inside a Windows service and blocks until the service is stopped.

Applies to