远程 COM 服务器实例化

发布于 2024-08-14 13:39:04 字数 82 浏览 3 评论 0原文

我有一个 COM 接口来启动和使用程序。这在本地机器上效果很好。是否可以通过网络在另一台计算机上启动该程序,而无需在其上安装其他软件或对程序进行更改?

I have a COM interface to start and use a program. This works great on a local machine. Is there a possibility to start that program on another machine, through the network without installing other software on it or making changes to the program?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

漫漫岁月 2024-08-21 13:39:05

DCOM 不过您需要配置安全性。

在 C# 中,您可以像这样远程实例化对象:

var obj = Activator.CreateInstance(Type.GetTypeFromProgID("Acme.Server", "remotepc", true));

因此实例化 VB Regex 库(以便它在其他地方运行)

dynamic re = Activator.CreateInstance(Type.GetTypeFromProgID("VBScript.RegExp", "remotepc", true));
re.IgnoreCase = true;   //Check that we can set properties
re.Pattern = "^A";
var chk = (re.Execute("Apple").Count > 0) ? "ok" : "failed";
Console.WriteLine(chk);

DCOM though you'll need to configure security.

In C# you can instantiate the object remotely like so:

var obj = Activator.CreateInstance(Type.GetTypeFromProgID("Acme.Server", "remotepc", true));

So to instantiate the VB Regex library (so that it runs elsewhere)

dynamic re = Activator.CreateInstance(Type.GetTypeFromProgID("VBScript.RegExp", "remotepc", true));
re.IgnoreCase = true;   //Check that we can set properties
re.Pattern = "^A";
var chk = (re.Execute("Apple").Count > 0) ? "ok" : "failed";
Console.WriteLine(chk);
帅气称霸 2024-08-21 13:39:05

您或许可以使用 COM+。您可以在远程创建 COM+ 应用程序计算机,然后创建安装包,然后最后在本地计算机上部署应用程序代理 。结果将允许您使用 COM 服务器就像在本地安装一样,而无需更改代码。

You might be able to use COM+. You can create a COM+ application on the remote machine, then create an installation package, and finally deploy the application proxy on your local machine. The result will allow you to use the COM server just as if it was installed locally, without having to change your code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文