2010-10-30 25 views
0
 

ServiceController service = new ServiceController("MyServiceName"); 

if ((service.Status.Equals(ServiceControllerStatus.Stopped)) || 

    (service.Status.Equals(ServiceControllerStatus.StopPending))) 

    service.Start(); 

else service.Stop(); 

服務在XP上運行,但在贏得7其不運行(與C#)

其對XP 32位的工作,但不能在Win工作7.ti拋出否認了異常訪問。 是否有任何解決方案this.plz幫助我。

回答

0

您的C#程序必須使用與您嘗試啓動的服務相同的憑據運行,否則由於Windows 7下的UAC需要升級 - 此示例爲here

相關問題