正在查看: .NET 分类下的文章 第1页 (共 1篇)

(英文)如何合理选择.NET Remoting的内置Channel

.NET Remoting有三种内置通道(Channel),包括Http, Tcp和IPC通道。如何正确的选择一个通道对Remoting应用程序的传输效率和稳定性会有较大影响。

简单说来,当以下情况出现时推荐使用HTTP管道:

  • 分布式系统部署在WAN中,需要穿透防火墙或代理服务器
  • 有与其他Web Service系统进行交互的需要
  • 使用IIS来架设和部署分布式系统

当出现以下情况时,推荐使用TCP管道:

  • 对传输效率要求极高
  • 大文件传输

IPC管道的使用由其本身的定义和特性所限制,所以推荐在跨进程的分布式应用程序中使用。

这是我采用英文撰写的一篇关于.NET Remoting文章的一部分,现在仅摘录出其中关于Remoting Channel的部分,以下为原文:

Remoting channels should be properly selected when distributed a real-time system.  A good decision of choosing a channel may improve both the transportation efficiency and the availability of the distributed application.

One should keep in mind that whether to choose one built-in channel with specific formatters depends on the requirements of the real-world distributed applications.

Using the HTTP Channel

When the messages of the distributed system are mainly required to transport over the Internet, it is better to use the HTTP Channel because of the potential impacts of the firewalls. There is always a good chance that the HTTP communication over port 80 or 8080 in some case will be enabled on most firewalls to provide web services to their Internet browser users. In this case, the HTTP Channel with either binary formatter or SOAP formatter should be used to improve the availability of the whole system.

When the distributed system is required to communicate with other remoting or distributed technologies, XML Web Service for example, the HTTP Channel with SOAP formatter is recommended in order to improve the interoperability of the distributed system.

When using IIS to host the server-side distributed components, it is also recommended to use the HttpChannel with the binary formatter for any application which spans multiple hosts (Rammer 2002).  The reason is that IIS provides a host of built-in advantages: built-in authentication, built-in encryption (SSL), and the ability to disable HTTP keepalives which further increases the scalability of your application as it reduces dependencies on single servers. At the same time, the binary formatter helps increase the transportation efficiency of serialized messages.

Using the TCP Channel

When the distributed system requires high performance and all the components are located in LAN, it is better to utilize the TCP Channel. For example, it is given that the system is required to transport large files across different application domain in Intranet, there is no better choice than using the TCP Channel with binary formatter that suits this case. However, this can be also completed successfully by using the HTTP Channel with binary formatter.

Using the IPC Channel

When the distributed system is required to across processes on a single computer, it is recommended to use the IPC Channel. Because the IPC Channel uses named pipes, and compared to use the built-in HTTP or TCP Channel, applications can generally obtain the highest communication performance while still being able to use impersonation and delegation to control access to the remote object. 

Tags: .net,remoting