How to make a .NET Windows Service start right after the installation?

前端 未结 8 1515
再見小時候
再見小時候 2020-11-22 10:49

Besides the service.StartType = ServiceStartMode.Automatic my service does not start after installation

Solution

Inserted this code on my Pr

8条回答
  •  余生分开走
    2020-11-22 11:27

    You can do this all from within your service executable in response to events fired from the InstallUtil process. Override the OnAfterInstall event to use a ServiceController class to start the service.

    http://msdn.microsoft.com/en-us/library/system.serviceprocess.serviceinstaller.aspx

提交回复
热议问题