2010-04-02 77 views
0

我有要求在远程服务器上重新启动MSDTC服务时抛出我的应用程序的代码。 你能帮我通过一个代码示例。如何从客户端计算机重新启动远程服务器上的MSDTC服务

感谢和问候 ShaBeg

+0

删除喜和感谢。应该从帖子中删除“你好”,“谢谢”以及标语和称呼吗? http://meta.stackexchange.com/questions/2950/should-hi-thanks-and-taglines-and-salutations-be-removed-from-posts – Kiquenet 2011-01-04 19:17:36

回答

0

可以使用SCNetsvc工具在this TechNet文章描述。

sc \\machine stop "Distributed Transaction Coordinator" 
sc \\machine start "Distributed Transaction Coordinator" 
2

这应该做的伎俩

System.ServiceProcess.ServiceController sc = 
    new System.ServiceProcess.ServiceController("Distributed Transaction Coordinator", "MachineName"); 
sc.Stop(); 
sc.Start(); 

在其下运行代码需要对远程机器的管理员权限,虽然该帐户。如果没有,您可以在运行代码以模拟具有远程框上的管理员权限的用户之前进行模拟。在ServiceController的类

MSDN信息:
http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx

相关问题