Build a .NET Worker Service, checks my website status
- Serilog Docs
-
A worker service runs all the time with no input.
-
on Linux these are Deamons
-
could also run on Azure
-
a Worker is able to test and see it in a console, when installed the console is hidden and runs as a service
- Can see the service in windows in
Task Manager
and theServices
tab.
- Use Powershell and SC (Service Control Manager)
-
Run Powershell as an Admin
-
Example
sc create {NAME} binpath="{PATH TO EXE}" start= auto
- My command
sc create WebsiteStatusCory binpath="C:\Users\Cory\Documents\_Code\WebsiteStatusApp\WebsiteStatus\bin\Release\WebsiteStatus.exe" start= auto
Will output a message service created successfully
- Open Powershell as an Admin
sc start WebsiteStatusCory
Using the Name used to create it
- Using Powershell as a Admin
- Stop the Service
sc stop WebsiteStatusCory
sc delete WebsiteStatusCory
if an error occurrs on delete, you may need to stop the service first.