dasMulli / dotnet-win32-service

Helper classes to set up and run as windows services directly on .net core. A ServiceBase alternative.
MIT License
451 stars 57 forks source link

DeleteService should stop the service #80

Open jnm2 opened 5 years ago

jnm2 commented 5 years ago

Otherwise, it stays running and in the Services list until the next time it stops for some other reason.

Would it ever make sense to delete and leave running? If so, could you add a bool stopImmediately parameter to DeleteService to mirror the startImmediately parameter on CreateService?

dasMulli commented 5 years ago

yup i'm all in for stopImmediately

dasMulli commented 5 years ago

There has been https://github.com/dasMulli/dotnet-win32-service/pull/75 before to implement stopping.

The reason i didn't want to put it in immediatly was because ServiceController has a more versatile method of stopping but i guess it should be fine to either copy that code or "just" use ServiceController.

jnm2 commented 5 years ago

@dasMulli I'd have a mild preference for avoiding an extra assembly, and maybe I'd support it by saying it would be more symmetrical on the outside (startImmediately doesn't require the extra assembly). 🤷‍♂️