【发布时间】:2013-03-08 16:48:33
【问题描述】:
我正在尝试编写一个 Windows 窗体应用程序,它可以让我检查/启动/停止多台服务器上的服务。我设置了代码来检查本地机器上的服务,但我不知道如何检查远程机器:
try
{
ServiceController machsmint = new ServiceController();
machsmint.ServiceName = "MACHSMIntegration";
if (machsmint.Status.ToString().ToLower() == "stopped")
{
label_machsmINTSTATUS.Text = "Service is not Running";
}
if (machsmint.Status.ToString().ToLower() == "running")
{
label_machsmINTSTATUS.Text = "Service is Running";
}
}
catch
{
label_machsmINTSTATUS.Text = "Service is not Running";
}
我需要在哪里添加代码以连接到远程机器,或者我在这里完全错误的方向?如果这是一个愚蠢的问题,我很抱歉!谢谢!
【问题讨论】:
标签: c# service remoting restart