Share via


WebHostService Class

Definition

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

public ref class WebHostService : System::ServiceProcess::ServiceBase
public class WebHostService : System.ServiceProcess.ServiceBase
type WebHostService = class
    inherit ServiceBase
Public Class WebHostService
Inherits 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