Skip to content

Instantly share code, notes, and snippets.

@cdcd72
Created April 10, 2020 09:25
Show Gist options
  • Save cdcd72/c1f11028864545544535283cb6f2fb3f to your computer and use it in GitHub Desktop.
Save cdcd72/c1f11028864545544535283cb6f2fb3f to your computer and use it in GitHub Desktop.
.Net core worker service deploy as windows service & control windows service script.
# Build and Publish Application
dotnet build
dotnet publish -c Release -o "PathToPublish"
# Create ServiceName Service
sc.exe create ServiceName binpath="PathToPublish\ServiceName.exe"
# Start ServiceName Service
sc.exe start ServiceName
# Stop ServiceName Service
sc.exe stop ServiceName
# Query ServiceName Service Status
sc.exe query ServiceName
# Delete ServiceName Service
sc.exe delete ServiceName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment