WebHostExtensions.Run Method

Definition

Overloads

Run(IWebHost)

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

Run(IWebHost, CancellationToken)

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

Run(IWebHost)

Source:
WebHostExtensions.cs
Source:
WebHostExtensions.cs
Source:
WebHostExtensions.cs

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

C#
public static void Run (this Microsoft.AspNetCore.Hosting.IWebHost host);

Parameters

host
IWebHost

The IWebHost to run.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

Run(IWebHost, CancellationToken)

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

C#
public static void Run (this Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token);

Parameters

host
IWebHost

The IWebHost to run.

token
CancellationToken

The token to trigger shutdown.

Applies to

ASP.NET Core 1.1 and ASP.NET Core 1.0
Product Versions
ASP.NET Core 1.0, 1.1