简体   繁体   English

进程间通信选项

[英]Inter-Process communication options

I need to subscribe inside one app for the event exposed by another app. 我需要在一个应用程序内订阅其他应用程序公开的事件。 I noticed that many people consider the using of WCF Named Pipes as the best practice. 我注意到许多人认为使用WCF命名管道是最佳实践。 Am I right that if I choose WCF Named Pipes I'll have to use IIS? 我是对的,如果我选择WCF命名管道,我将不得不使用IIS?

And by the way, what options do I have in general? 顺便说一句,我一般有什么选择?

Named pipes are one of the fastest way to do IPC (inter-process communication) on the same machine. 命名管道是在同一台机器上进行IPC(进程间通信)的最快方法之一。 The have existed for a long while (was NT4 the first OS?) and not specific for WCF. 已经存在了很长一段时间(NT4是第一个操作系统?)而不是特定于WCF。

I would however not use WCF/Named pipes through ASP.NET as IIS do not use named pipes for it's communication. 但是,我不会通过ASP.NET使用WCF /命名管道,因为IIS不使用命名管道进行通信。 that means that your app will close if IIS have not received HTTP requests for a while. 这意味着如果IIS暂时没有收到HTTP请求,您的应用将关闭。

How you should host your IPC depends on the type of application. 如何托管IPC取决于应用程序的类型。 If you want to always have your server running you should host it in a windows service. 如果您希望始终运行服务器,则应将其托管在Windows服务中。 Otherwise you could just include it in your desktop app. 否则,您可以将其包含在桌面应用中。

You do not necessarily have to use WCF, you can use named pipes directly (look at the link in the beginning of my message). 您不一定要使用WCF,您可以直接使用命名管道(查看我的消息开头的链接)。 It all depends on how complex your communication is. 这完全取决于您的沟通有多复杂。

Am I right that if I choose WCF Named Pipes I'll have to use IIS And by the way, what options do I have in general? 我是对的,如果我选择WCF命名管道我将不得不使用IIS顺便说一句,我一般有什么选择?

No, not really. 不,不是真的。 Although this is an option but you have other options as well. 虽然这是一个选项,但您也有其他选择。 Like, 喜欢,

  • Self-Hosting Your Service 自我托管您的服务
  • Hosting in Windows Services 在Windows服务中托管
  • Hosting Using Internet Information Services (IIS) 使用Internet信息服务(IIS)托管

    which you can read in detail here . 你可以在这里详细阅读。

Named pipes existed even before WCF and WCF is certainly not the only way to use them 甚至在WCF和WCF之前存在命名管道肯定不是使用它们的唯一方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM