![](/img/trans.png)
[英]How to host a web service so other clients connected to same network can access
[英]How can i access machine on same network and start a service?
我有winforms應用程序在同一網絡上的某些Windows機器上訪問WCF服務。 有時WCF服務由於其中的一些錯誤而關閉,我希望能夠訪問具有服務的計算機並在服務停止時啟動服務。
我想從WinForms C#應用程序中做到這一點。
如何從WinForms應用程序訪問Windows機器並對其執行命令。 即
sc \\機器停止
試試System.ServiceProcess.ServiceController類。
var svc = new ServiceController("WCFServiceName", "ComputerName");
if (svc.Status == ControllerStatus.Stopped)
{
sc.Start();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.