Delen via


IWebHost Interface

Definition

Represents a configured web host.

public interface class IWebHost : IDisposable
public interface IWebHost : IDisposable
type IWebHost = interface
    interface IDisposable
Public Interface IWebHost
Implements IDisposable
Implements

Properties

ServerFeatures

The IFeatureCollection exposed by the configured server.

Services

The IServiceProvider for the host.

Methods

Start()

Starts listening on the configured addresses.

StartAsync(CancellationToken)

Starts listening on the configured addresses.

StopAsync(CancellationToken)

Attempt to gracefully stop the host.

Extension Methods

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.

RunAsService(IWebHost)

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

GetTestClient(IWebHost)

Retrieves the test client from the TestServer in the host services.

GetTestServer(IWebHost)

Retrieves the TestServer from the host services.

Applies to