WebHostService Class¶
Provides an implementation of a Windows service that hosts ASP.NET Core.
- Namespace
Microsoft.AspNetCore.Hosting.WindowsServices
- Assemblies
- Microsoft.AspNetCore.Hosting.WindowsServices
Inheritance Hierarchy¶
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.ServiceProcess.ServiceBase
Microsoft.AspNetCore.Hosting.WindowsServices.WebHostService
Syntax¶
public class WebHostService : ServiceBase, IComponent, IDisposable
-
class
Microsoft.AspNetCore.Hosting.WindowsServices.
WebHostService
Constructors¶
-
WebHostService
(Microsoft.AspNetCore.Hosting.IWebHost)¶ Creates an instance of <code>WebHostService</code> which hosts the specified web application.
Arguments: host (Microsoft.AspNetCore.Hosting.IWebHost) – The configured web host containing the web application to host in the Windows service. public WebHostService(IWebHost host)
-
Methods¶
-
OnStart
(System.String[])¶ protected override sealed void OnStart(string[] args)
-
OnStarted
()¶ Executes after ASP.NET Core starts.
protected virtual void OnStarted()
-
OnStarting
(System.String[])¶ Executes before ASP.NET Core starts.
Arguments: args (System.String<System.String>[]) – The command line arguments passed to the service. protected virtual void OnStarting(string[] args)
-
OnStop
()¶ protected override sealed void OnStop()
-
OnStopped
()¶ Executes after ASP.NET Core shuts down.
protected virtual void OnStopped()
-
OnStopping
()¶ Executes before ASP.NET Core shuts down.
protected virtual void OnStopping()
-