Detect if code is running as a service

前端 未结 9 1391
谎友^
谎友^ 2020-12-10 16:30

Is there a way for an .NET library to detect whether or not it is being run as a service?

My library can be run either way. But when its run as a service, developer

9条回答
  •  爱一瞬间的悲伤
    2020-12-10 16:46

    The answer by 0xA3 to this question actually contains C# code to query the SCM, much like Rob Parker describes in his answer.

提交回复
热议问题