Is it possible for one C# (desktop) application to start and stop ap开发者_如何学JAVAplications on another machine?
I don't mean in a malicious sense, or even over the internet. I have two computers in a room and I need an app on one to start (and then stop) and app on the other.
One half-formed route in my mind was to use an auxiliary program on the target computer, so I suppose I ought to point out that I am completely able to make any necessary changes to either machine.
If you can do changes there are so many possibilities!
- WMI : Never tried that out but given sufficient rights you should be able to start processes, or at least services on a remote machine
- .NET remoting: Somewhat old, but easy to implement
- WCF
- HttpListener
- Private Message Queues (that's what I did once)
- ?
Most of the alternatives involve writing a small service that listens on the communication technique of your choice and then starts a process or does something else.
An example using WMI is up on Code Project:
Create a Remote Process using WMI in C#
But probably in your case a simple PsExec.exe
call might be enough, e.g.
Process.Start("psexec.exe", "\\remotehost -u user -p password calc.exe");
psexec.exe from sysinternals or Use Powershell 2.0 and WMI
精彩评论