如何强制进程隔离一个进程外COM服务器? [英] How to force process isolation for an out of process COM server?

查看:282
本文介绍了如何强制进程隔离一个进程外COM服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写管理code,它必须与运行进程外的一个供应商的COM自动化服务器进行交互。我已发现,此服务器,如果一个以上的客户端连接到它变得不稳定。例如,如果我已设法code过程A和管理code过程B都连接到这个COM服务器,一个进程将被剥离为COM服务器,它的行为是小于可靠。 我希望有办法迫使一个单独的进程为每个客户端 - 服务器连接即可。理想情况下,我想直到结束:

I'm writing managed code that has to interact with a vendor's COM automation server that runs out of process. I have found that this server becomes unstable if more than one client connects to it. For example, if I have managed code in process A and managed code in process B both connecting to this COM server, a single process will be spun up for the COM server and it's behavior is less than reliable. I'm hoping there's a way to force a separate process for each client - server connection. Ideally, I'd like to end up with:

管理过程一只会说话的,以COM服务器过程中的 C1

管理过程B过程交谈COM服务器的 C2

Managed Process A talking to COM Server in process C1
Managed Process B talking to COM Server in process C2

这浮现在脑海的一个想法是,如果我跑进程A和进程B具有不同的安全标识,这可能导致COM基础设施,以创建单独的服务器进程。我宁愿不但是这条路走。管理进程A和托管进程B实际上是Windows服务。我正与身份本地系统中运行它们(因为我需要他们能够与桌面交互,你不能检查服务小程序中的交互与桌面框不作为本地服务系统)。我需要与桌面交互的原因是,这个COM服务器偶尔抛出了一个对话框,在屏幕上,如果服务本身无法与桌面交互那么COM服务器产卵无法显示该对话框(我相信这是在隐藏WinStation显示)。

One thought that came to mind was that if I ran process A and process B with different security identities, that that might cause the COM infrastructure to create separate server processes. I'd rather not go down that road, however. Managed Process A and Managed Process B are actually Windows Services. And I'm running them with identity Local System (because I need them to be able to interact with the desktop, and you can't check the "Interact with Desktop" box on the services applet for services that don't run as Local System). And the reason I need to interact with desktop is that this COM server occasionally throws up a dialog box on the screen and if the service itself cannot interact with the desktop then the COM server is spawns can't display the dialog (I believe it is displayed on a hidden WinStation).

推荐答案

将在COM +注册的组件,这把隔离在你的层。结果
使用方法:控制面板 - >管理工具|
      或CMD /执行DCOMCNFG

Place the component registered at COM+, this put an isolation layer at your.
Use : Control Panel->Administrative Tools
or cmd/execute DCOMCNFG

组件服务 - > Computers->我的电脑> COM +应用程序,右击,新的应用程序,然后创建一个空的应用程序,输入程序名COM + your.dll,下一步,选择本地服务,下一步,下一步,接下来,完成。

Component Services->Computers->My Computer->COM+ Application, right click, new application, next, Create an empty application, enter app name "COM+ your.dll", next, select Local Service, next, next, next, finish.

在做新项目,扩大在组件,单击右键,新组件,下一步,选择安装新组件,请选择您的组件。

In new item made, expand, at Components, right click, new component, next, select Install new component, select your component.

点击组件属性,标签标识,选择系统帐户。

Click Component properties, tab Identity, select System Account.

有关在通话错误请参阅事件之后。

For errors in calls see Event after.

这篇关于如何强制进程隔离一个进程外COM服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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