执行另一台机器上安装的远程程序 [英] Executing Remote Program installed on another machine

查看:91
本文介绍了执行另一台机器上安装的远程程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我不想问这个,因为我知道有太多信息,但我无法找到明确的答案。我想要做的是我将参与一个程序,当我说按一个按钮时,我想启动一个在另一台机器上运行的程序。
我相信System.Remoting Assembly是我想要使用的,但有人可以指出一些很好的例子,这些例子会引导我朝着正确的方向前进。谢谢

Hello and I hate to ask this because I know there is so much info but I am not able to find a clear answer. What I want to do is I am going to be in a program and when I let say click a button I want to launch a program that is running on another machine. I believe System.Remoting Assembly is what I want to use but could someone point me to some good examples that would lead me in the right direction. Thanks

C

 

推荐答案

当你说,启动另一台机器上运行的程序时,你的意思是:

When you say, launch a program that is running on another machine, do you mean:

- 程序启动/运行(如在内存中加载并显示在任务管理器中)和当您单击远程应用程序上的按钮时,您希望此程序执行某项操作。

- The program is started/running (as in loaded in memory and showing up in task manager) and you want this program to perform a certain operation when you click the button on the remote application.

- 程序未启动/运行,您希望它在您单击按钮时启动在远程应用程序上。

- The program is not started/running, and you want it to start when you click the button on the remote application.

如果是后者,System.Remoting不适合您。可能最好用的是WMI(System.Management)。有关该主题的文章可以在这里找到:
http://www.codeproject.com/KB/ CS / Remote_Process_using_WMI_.aspx 。但基本的是你为远程机器创建一个所谓的管理范围,并在Win32_Process管理路径上执行Create WMI
方法。

If it is the latter, System.Remoting is not the thing for you. Probably the best thing to use then is WMI (System.Management). An article on the subject can be found here: http://www.codeproject.com/KB/cs/Remote_Process_using_WMI_.aspx. But the basics are that you create a so called Management Scope for the remote machine, and execute the Create WMI method on the Win32_Process management path.

如果程序已经启动它在你自己的控制下(也就是你有源代码,如果需要可以改变它),它是使用System.Remoting的一个非常好的选择。但是,由于您似乎尚未使用System.Remoting,因此使用WCF可能需要
(仅适用于.NET 3.0)。有更多关于它的文档,在我看来是一个更好的编程模型。

If the program is already started and its under your own control (aka you have the source code, and can change that if needed), its a perfectly good option to use System.Remoting. However since it seems you have not yet used System.Remoting yet, its probably better to use WCF (only available since .NET 3.0). There is more documentation about that, and in my opinion a much nicer programming model.

关于远程处理的一篇好文章可以在这里找到:
http://www.codeproject.com/KB/IP/Net_Remoting.aspx
。请注意,您的远程应用程序将是服务器,您应该在应用程序启动时启动远程应用程序的服务器部分。客户端部分可以位于按钮的OnClick事件
处理程序中。

A good article on Remoting can be found here: http://www.codeproject.com/KB/IP/Net_Remoting.aspx. Please note that your remote application will be the server, and you should probably start the server part of the remoting code at application startup. The client part can be in the button's OnClick event handler.

可以在此处找到一个非常简单的带有WCF的客户端 - 服务器示例
http://weblogs.asp.net/ ralfw /存档/ 2007/04/14 / A-忠实地-简单例子对GET-开始与 - wcf.aspx
。同样适用于此,服务器代码进入远程应用程序,按钮的OnClick事件处理程序中的客户端代码。

A very simple Client-Server sample with WCF can be found here http://weblogs.asp.net/ralfw/archive/2007/04/14/a-truely-simple-example-to-get-started-with-wcf.aspx. Same applies here, server code goes in your remote app, client code in the button's OnClick event handler.

顺便说一句,如果应用程序是您无法控制的第三方应用程序,则必须从供应商那里了解它是否有任何可以编程的API。它可能已经具有远程可访问的API,但如果它只有一个本地可访问的
API,则需要编写一个包装器。

Btw, if the application is a 3rd party application over which you have no control, you will have to find out from the vendor if it has any API's against which you can program. It might already have remote accessible API's, but if it only has a local accesible API you will need to write a wrapper.


这篇关于执行另一台机器上安装的远程程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆