Прочитај на енглеском

Делите путем


WebHostService Class

Definition

Provides an implementation of a Windows service that hosts ASP.NET Core.

C#
public class WebHostService : System.ServiceProcess.ServiceBase
Inheritance
WebHostService

Constructors

WebHostService(IWebHost)

Creates an instance of WebHostService which hosts the specified web application.

Methods

OnStart(String[])

When implemented in a derived class, executes when a Start command is sent to the service by the Service Control Manager (SCM) or when the operating system starts (for a service that starts automatically). Specifies actions to take when the service starts.

OnStarted()

Executes after ASP.NET Core starts.

OnStarting(String[])

Executes before ASP.NET Core starts.

OnStop()

When implemented in a derived class, executes when a Stop command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service stops running.

OnStopped()

Executes after ASP.NET Core shuts down.

OnStopping()

Executes before ASP.NET Core shuts down.

Applies to

Производ Верзије
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