Start Windows Service in C#
问题 I want to start a windows service that was just installed. ServiceBase[] ServicesToRun; if (bool.Parse(System.Configuration.ConfigurationManager.AppSettings["RunService"])) { ServicesToRun = new ServiceBase[] { new IvrService() }; ServiceBase.Run(ServicesToRun); } The IvrService code is: partial class IvrService : ServiceBase { public IvrService() { InitializeComponent(); Process myProcess; myProcess = System.Diagnostics.Process.GetCurrentProcess(); string pathname = Path.GetDirectoryName