Skip to content

Latest commit

 

History

History

windows-service-1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Hosting Kestrel from Windows Service

This sample shows how to create a Windows Service that runs a Kestrel server. Further documentation is here.

This sample requires dependency from Microsoft.Extensions.Hosting.WindowsServices.

How to install the windows service

Run Visual Studio Command Line under administrator mode.

Run VS Studio Command Line

Run the following command sc create "{Fill Service Name} binpath="{Full path to your Windows Service EXE}"

Run the command

Open Windows Services Manager and start the service.

Validate

or you can execute this command sc start "{Fill Service Name}" to start the service from the VS Command Line.

To stop the service, execute this command sc stop "{Fill Service Name}".

How to remove the windows service.

Run Visual Studio Command Line under administrator mode.

Run the following command sc delete "{Fill Service Name}".

dotnet6

close