进程之间及跨进程的Appdomain之间通讯方式
进程间通信(IPC,Inter-Process Communication),指至少两个进程或线程间传送数据或信号的一些技术或方法。进程是计算机系统分配资源的最小单位。每个进程都有自己的一部分独立的系统资源,彼此是隔离的。为了能使不同的进程互相访问资源并进行协调工作,才有了进程间通信。这些进程可以运行在同一计算机上或网络连接的不同计算机上。
进程间通信技术包括消息传递、同步、共享内存和远程过程调用。IPC是一种标准的Unix通信机制。
使用IPC 的理由:
- 资讯共享
- 加速;
- 模组化;
- 方便; 以及
- 私有权分离.
主要的 IPC 方法
方法 | 提供方(操作系统或其他环境) |
---|---|
档案 | 多数操作系统 |
信号 | 多数操作系统 |
Socket | 多数操作系统 |
消息队列(en:Message queue) | 多数操作系统 |
管道(en:Pipe) | 所有的 POSIX systems, Windows. |
具名管道(en:Named Pipe) | 所有的 POSIX 系统, Windows. |
信号量(en:Semaphore) | 所有的 POSIX 系统, Windows. |
共享内存 | 所有的 POSIX 系统, Windows. |
Message passing(en:Message passing) (不共享) | 用于 MPI规范,Java RMI, CORBA, MSMQ, MailSlot 以及其他. |
Memory-mapped file(en:Memory-mapped file) | 所有的 POSIX 系统, Windows. |
XML Web Services
XML Web services created by using ASP.NET work well if you build Active Server Pages (ASP) applications by using the Web application model and the ASP.NET HTTP runtime, including strong support in Microsoft Visual Studio .NET. With the XML Web service infrastructure, you can easily create components for other applications to use or use components that others have created by using protocols, formats, and data types most appropriate to Web-based applications. Exact type fidelity between computers is not supported, and only some types of arguments can be passed. For more information, see XML Web Services Created Using ASP.NET and XML Web Service Clients.
System.Net Namespace
You can use the classes in the System.Net namespace to build an entire communication structure from the socket level. You can also use the System.Net classes to implement communication protocols and serialization formats that you can plug into the remoting architecture. For more information, see Network Programming.
Enterprise Services
Enterprise Services builds on the .NET remoting infrastructure to provide all the richness and flexibility of the COM+ distributed object model, including support for widely-distributed transactions.
.NET Remoting
.NET remoting provides the tools for any number of comprehensive communication scenarios that include XML Web services. Using .NET remoting, you can:
Publish or consume services in any type of application domain, whether that domain is a console application, Windows Form, IIS, XML Web service, or Windows Service.
Preserve full managed code type system fidelity in binary formatted communications, including support for generic types.
XML Web services use SOAP formatting, which does not preserve all type details.
Pass objects by reference and return to a particular object in a particular application domain.
Control activation characteristics and object lifetimes directly.
Implement and use third-party channels or protocols to extend communication to meet your specific requirements.
Participate directly in the communication process to create the functionality you need.
See Also
posted on 2012-03-27 21:32 malaikuangren 阅读(679) 评论(0) 编辑 收藏 举报