如何实现单个 .NET 组件以供多个进程使用?
我想在 .NET 中实现一个组件,并通过 COM 互操作在 COM 感知的客户端中使用它。
我希望这个组件成为所有使用它的进程中的单例。
此线程建议使用WCF/远程处理,但没有详细介绍。有好的参考/例子吗?
I would like to implement a component in .NET, and consume it in COM-aware clients via COM interop.
I would like this component to be a singleton across all processes that use it.
This thread suggests using WCF/remoting but doesn't go into much detail. Is there a good reference/example?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
远程处理已成为过去,并已被 WCF 取代。
您需要实现 WCF 服务并将实例模式设置为 Single< /a>.
我建议您将其公开为命名管道服务并将其托管在 Windows 服务上。但是,如果它开始给您带来命名管道强化,您可能必须使用 TCP 绑定。
Remoting is a relic of the past and has been replaced by WCF.
You need to implement a WCF service and set the instancing mode to Single.
I suggest you expose it as a Named Pipe service and host it on Windows service. A word of caution, however, if it starts giving you problems with Named Pipe hardening, you might have to use TCP binding.
为什么不创建一个与 COM 组件通信的 Windows 服务呢? COM 是所有用户使用的接口,而服务包含实际逻辑。
Why not create a windows service that the COM component communicates with? The COM is the interface that all your users work with while the service contains the actual logic.