WCF笔记(一)Service Layer and Channel Layer

WCF整体上有Channel LayerService Layer之分。 

我们开发人员一般与Service Layer打交道,编写好Contract和Service。在Host和Client配置对应的Endpoint,就可以搭起一套WCF应用。

 

Service Layer:

 

 

Channel Layer:

       Server

                Listen Request->Accept Request->Process Request->Send Reply

Client

           Send Request->Receive Reply

Interface:System.ServiceModel.Channels.IChannel,

BaseClass:ChannelBase

Channel Stack

                   1)整个Messaging过程通过一连串Channel来实现,这些Channel按照一定的顺序组成一个Channel stack

                   2)所有的消息交互功能都是通过Channel stack来实现,而组成Channel stack的一个个Channel又是通过Channel factoryChannel listener来创建的

                   3) Channel factoryChannel listener通过Binding创建不同的MEP对应不同的Channel

   Channel Shape

    * Datagram:数据报方式,采用One-way的消息交换模式。

    * Request/Reply:请求/恢复方式,采用传统的Request/Reply 消息交换模式。

    * Duplex:双向通信,采用Duplex消息交换模式。

    * P2P :点对点方式通信, 采用Duplex消息交换模式。

MEPChannel Interface 对应表:

MEP 

Sender 

Receiver

Datagram

IOutputChannel

IInputChannel

Request/Reply

IRequestChannel

IReplyChannel

Duplex

IDuplexChannel

IDuplexChannel

P2P

IDuplexChannel

IDuplexChannel

Channel的创建

                   发送方:Channel  factory

                   接受方:Channel  Listener

原文地址:https://www.cnblogs.com/tenghoo/p/1595179.html