Using worker service template in order to create long-running cross-platform services
In this repo, i m building a long running background service based on worker service template.
Worker services are a great way to create cross-plateform services that can be deployed on :
📌 windows
📌 linux
📌 docker
In this repo, the worker displays features from configuration file based on 3 strategies :
1️⃣
ConfigurationOptionsService
: static reading of configuration features2️⃣
ConfigurationOptionsSnapshotService
: dynamic reading of configuration features3️⃣
ConfigurationOptionsMonitorService
: dynamic reading of configuration featuresIn order to deploy the worker as a windows service, type the following commands in your terminal :
✅ Build in release mode :
dotnet build -c release
✅ Publish to some folder :
dotnet publish -o [PATH-TO-FOLDER]
✅ Create windows service :
sc create [SERVICE-NAME] binPath=[PATH-TO-FOLDER]\[App.exe]
✅ Delete windows service :
sc delete [SERVICE-NAME]
Tools
: net 8.0