我有一个服务,我从一个表格开始这个服务:
ctl = ServiceController.GetServices().Where(s => s.ServiceName == "ServiceA").First();
ctl.Start();
MessageBox.Show(ctl.Status.ToString());//Running
我在 Windows 8 的任务管理器中检查了该服务,它正在运行。但是我添加了这样的代码:
public ServiceA()//constructor method
{
MessageBox.Show("Started");
}
但是当进程运行时,我看不到任何包含“已启动”内容的消息框。问题是什么?