Can a service written in .NET self-terminate?

前端 未结 4 1215
耶瑟儿~
耶瑟儿~ 2020-12-03 07:04

I have a service application written in C# and under certain circumstances, I would like it to terminate itself. This would happen after the service has been running for a

4条回答
  •  渐次进展
    2020-12-03 08:00

    Don't have the service run under Local Service. Have it run under a user that has the rights to stop a service.

    Although the idea of self-terminating services is not the best of ideas. That very fact alone means that it should be an application, and not a service.

提交回复
热议问题