1

我有一个服务,我从一个表格开始这个服务:

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");
}

但是当进程运行时,我看不到任何包含“已启动”内容的消息框。问题是什么?

4

1 回答 1

2

Windows 服务不允许显示消息框。您可以参考这个Stack Overflow 问题了解更多详情。

于 2013-05-26T16:51:14.933 回答