双向进程间通信(通过命名管道)- WCF 或 .Net Remoting?

发布于 2024-10-01 03:16:39 字数 368 浏览 2 评论 0原文

我有一个似乎相当常见的进程间通信需求 - 父进程生成一些子进程,并且父进程和子进程需要能够彼此执行双向通信(子进程需要保持父进程的状态是最新的,并且父进程需要能够检查子进程是否仍然存在 - 请注意,子进程不需要相互通信)。

我一直在考虑使用 WCF 来做到这一点,但我对使用 WCF 进行此类 IPC 还不熟悉 - 据我所知,为了获得这种双向通信,我需要父进程和子进程公开 WCF 服务,这看起来有点麻烦。

另一方面,.Net Remoting 使这种通信几乎无缝,但每个人似乎都认为 Remoting 已经过时了,我应该使用 WCF。

所以我正在努力选择我应该采取的方法: - 我的目标是让沟通尽可能简单。 - 安全并不是真正的问题。

我应该选择哪个?

I have what seems to be a fairly common inter-process communication requirement - a parent process spawns some child processes, and the parent process and child processes need to be able to perform two-way communication with each other (the child process needs to keep the parent process up-to-date with its state and the parent process needs to be able to check that the child process is still alive - note that the child processes don't need to communicate with each other).

I've been looking into doing this using WCF, but I'm new to using WCF for this sort of IPC - as far as I can tell in order to get this two-way communication I'd need both the parent process and the child process to expose WCF services, which seems like a bit of a faff.

On the other hand .Net Remoting makes this sort of communication almost seamless, but everyone seems to be of the opinion that Remoting is old-hat and I should use WCF instead.

So I'm struggling to choose the approach I should take:
- My goal is to make the communication as uncomplicated as possible.
- Security isn't really an issue.

Which should I choose?

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

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

发布评论

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

评论(2

爱人如己 2024-10-08 03:16:39

这两种技术都应该适合您想要做的事情。这两个 API 之间的主要设计差异是:

  • 远程处理旨在使所有接口看起来都是本地的,无论其来源如何。
  • WCF 旨在使所有接口看起来都是远程的,无论其来源如何。

WCF 似乎更复杂,因为它暴露了复杂性而不是隐藏它。由于您既定的目标是消除代码复杂性,因此您不妨选择远程处理。

话虽如此,WCF 将允许您稍后改进您的实现,例如更改协议、添加安全性等。只有当您完全确定您永远不需要这样做时,您才应该放弃 WCF。

我在所有方面都更喜欢 WCF 方法,但这是一个非常主观的偏好。

Both technologies should be suitable for what you want to do. The main design difference between the two APIs is:

  • Remoting is designed to make all interfaces look local, regardless of their origin.
  • WCF is designed to make all interfaces look remote, regardless of their origin.

WCF appears to be more complex because it exposes the complexity rather than hiding it. Since your stated goal is to remove code complexity, you might as well go for Remoting.

Having said that, WCF will allow you to evolve your implementation later on, e.g. change protocols, add security, etc. Only if you are absolutely sure you will never need to do this should you drop WCF.

I prefer the WCF approach for everything, but that's a very subjective preference.

没企图 2024-10-08 03:16:39

取决于您的应用程序(父母和孩子)的健谈程度。

如果通信是相当基本的,您可以选择 .NET Remoting,但如果您有更复杂的通信方案,我(个人)会选择 WCF。

Depends on how talkative your applications (parent and children) are.

If communication is rather basic you can go for .NET Remoting, but if you have a more complex communication scheme, I (personally) would go with WCF.

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