gpt4 book ai didi

c# - WCF - 最快的进程间通信

转载 作者:太空狗 更新时间:2023-10-29 18:19:16 24 4
gpt4 key购买 nike

A 有一个可通过 Web 访问(通过 basicHttpBinding)的 WCF 服务,我还想从同一台机器上的其他 .NET 服务访问该服务,并尽可能提高性能。我知道 netNamedPipeBinding 对此非常理想,但想知道最好的配置是什么,我什至只打算与其他 .NET 进程通信。

例如,我不一定要使用诸如 SOAP 之类的编码,因为它可能过于庞大,而且我不需要与 .NET 客户端以外的任何其他客户端兼容。我也不认为我需要任何安全措施。

为此目的(或与此相关的任何其他配置)的最佳绑定(bind)配置是什么

最佳答案

如您所见,NetNamedPipeBinding绑定(bind)针对同机通信进行了优化:

Provides a secure and reliable binding that is optimized for on-machine communication.

引用。 : System-Provided Bindings

在 Juval Lowy 的书“Programming WCF Services”的第一章中,他提供了一个有用的决策事件图来选择正确的绑定(bind):

"The first question you should ask yourself is whether your service needs to interact with non-WCF clients. If the answer is yes, and if the client is a legacy MSMQ client, choose the MsmqIntegrationBinding that enables your service to interoperate over MSMQ with such a client. If you need to interoperate with a non-WCF client and that client expects basic web service protocol (ASMX web services), choose the BasicHttpBinding, which exposes your WCF service to the outside world as if it were an ASMX web service (that is, a WSI-basic profile). The downside is that you cannot take advantage of most of the modern WS-* protocols. However, if the non-WCF client can understand these standards, choose one of the WS bindings, such as WSHttpBinding, WSFederationHttpBinding, or WSDualHttpBinding. If you can assume that the client is a WCF client, yet it requires offline or disconnected interaction, choose the NetMsmqBinding that uses MSMQ for transporting the messages. If the client requires connected communication, but could be calling across machine boundaries, choose the NetTcpBinding that communicates over TCP. If the client is on the same machine as the service, choose the NetNamedPipeBinding that uses named pipes to maximize performance. You may fine-tune binding selections based on additional criteria such as the need for callbacks (WSDualHttpBinding) or federated security (WSFederationHttpBinding)."

关于c# - WCF - 最快的进程间通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4485650/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com