WebHostService Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
Use UseWindowsService and AddHostedService instead. For more information, visit https://aka.ms/aspnet/deprecate/009.
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
[System.Obsolete("Use UseWindowsService and AddHostedService instead. For more information, visit https://aka.ms/aspnet/deprecate/009.", DiagnosticId="ASPDEPR009", UrlFormat="https://aka.ms/aspnet/deprecate/009")]
public class WebHostService : System.ServiceProcess.ServiceBase
type WebHostService = class
inherit ServiceBase
[<System.Obsolete("Use UseWindowsService and AddHostedService instead. For more information, visit https://aka.ms/aspnet/deprecate/009.", DiagnosticId="ASPDEPR009", UrlFormat="https://aka.ms/aspnet/deprecate/009")>]
type WebHostService = class
inherit ServiceBase
Public Class WebHostService
Inherits ServiceBase
- Inheritance
-
WebHostService
- Attributes
Constructors
| Name | Description |
|---|---|
| WebHostService(IWebHost) |
Creates an instance of |
Methods
| Name | Description |
|---|---|
| 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. |