WCF - Architecture

WCF - Architecture

WCF has a layered architecture that offers ample support for developing various distributed applications. The architecture is explained below in detail.

wcf有一个分层的架构,为开发不同的分布式应用提供了足够的支持。架构图的细节如下图所示

Contracts   契约

The contracts layer is just next to the application layer and contains information similar to that of a real-world contract that specifies the operation of a service and the kind of accessible information it will make. Contracts are basically of four types discussed below in brief:

契约层紧挨着应用层,它包含的信息和现实世界中的界面类似,指定了服务的操作,服务产生的可访问信息的类型。简单来说,契约有以下4种类型

  • Service contract - This contract provides information to the client as well as to the outer world about the offerings of the endpoint, and the protocols to be used in the communication process.
  • Data contract - The data exchanged by a service is defined by a data contract. Both the client and the service has to be in agreement with the data contract.
  • Message contract - A data contract is controlled by a message contract. It primarily does the customization of the type formatting of the SOAP message parameters. Here, it should be mentioned that WCF employs SOAP format for the purpose of communication. SOAP stands for Simple Object Access Protocol.
  • Policy and Binding - There are certain pre-conditions for communication with a service, and such conditions are defined by policy and binding contract. A client needs to follow this contract.

1.服务契约:提供给信息给客户端以及外部世界,信息是关于endpoint提供的,以及进程间通讯使用的协议

2.数据契约:由服务进行交换的数据,定义在数据契约中。 客户端和服务端都必须与数据契约保持一致

3.消息契约:数据契约由消息契约进行控制。它主要用来处理soap消息参数格式的自定义类型。这里,它应该提到wcf所使用的用于通信目的的soap格式。 soap表示Simple Object Access Protocol.

4.策略和绑定:有一些和服务进行通信的前提条件,比如由策略以及绑定契约所定义的条件。客户端需要按照这个契约来处理

Service Runtime

The service runtime layer is just below the contracts layer. It specifies the various service behaviors that occur during runtime. There are many types of behaviors that can undergo configuration and come under the service runtime.

  • Throttling Behavior - Manages the number of messages processed.
  • Error Behavior - Defines the result of any internal service error occurrence.
  • Metadata Behavior - Specifies the availability of metadata to the outside world.
  • Instance Behavior - Defines the number of instances that needs to be created to make them available for the client.
  • Transaction Behavior - Enables a change in transaction state in case of any failure.
  • Dispatch Behavior - Controls the way by which a message gets processed by the infrastructure of WCF.
  • Concurrency Behavior - Controls the functions that run parallel during a client-server communication.
  • Parameter Filtering - Features the process of validation of parameters to a method before it gets invoked.

Messaging

This layer, composed of several channels, mainly deals with the message content to be communicated between two endpoints. A set of channels form a channel stack and the two major types of channels that comprise the channel stack are the following ones:

  • Transport Channels - These channels are present at the bottom of a stack and are accountable for sending and receiving messages using transport protocols like HTTP, TCP, Peer-to-Peer, Named Pipes, and MSMQ.
  • Protocol Channels - Present at the top of a stack, these channels also known as layered channels, implement wire-level protocols by modifying messages.

Activation and Hosting

The last layer of WCF architecture is the place where services are actually hosted or can be executed for easy access by the client. This is done by various mechanisms discussed below in brief.

  • IIS - IIS stands for Internet Information Service. It offers a myriad of advantages using the HTTP protocol by a service. Here, it is not required to have the host code for activating the service code; instead, the service code gets activated automatically.
  • Windows Activation Service - This is popularly known as WAS and comes with IIS 7.0. Both HTTP and non-HTTP based communication is possible here by using TCP or Namedpipe protocols.
  • Self-hosting - This is a mechanism by which a WCF service gets self-hosted as a console application. This mechanism offers amazing flexibility in terms of choosing the desired protocols and setting own addressing scheme.
  • Windows Service - Hosting a WCF service with this mechanism is advantageous, as the services then remain activated and accessible to the client due to no runtime activation.
时间: 2024-11-09 07:16:48

WCF - Architecture的相关文章

WCF服务编程 读书笔记——第1章 WCF基础(2)

续:第1章 WCF基础(1) 元数据交换 服务有两种方案可以发布自己的元数据.一种是基于HTTP-GET协议提供元数据, 另一种则是后面将要讨论的使用专门的终结点的方式.WCF能够为服务自动提供基于HTTPGET的元数据,但需要显式地添加服务行为( Behavior)以支持这一功能.本书后面的章节会介绍行为的相关知识.现在,我们只需要知道行为属于服务的本地特性,例如是否需要基于HTTP-GET交换元数据, 就是一种服务行为.我们可以通过编程方式或管理方式添加行为.在例 1 - 10 演示的宿主应

Service Oriented Architecture

What is Service Oriented Architecture (SOA)? There have been so many interpretations of this throughout the years that it seems important to establish a common understanding before I discuss WCF as an SOA platform. The Organization for the Advancemen

Difference between WCF and Web API and WCF REST and Web Service

The .Net framework has a number of technologies that allow you to create HTTP services such as Web Service, WCF and now Web API. There are a lot of articles over the internet which may describe to whom you should use. Now a days, you have a lot of ch

WCF服务在高并发情况下报目标积极拒绝的异常处理 z

http://www.cnblogs.com/kklldog/p/5037006.html wcf的监控服务,偶尔监控到目标服务会报一个目标积极拒绝的错误.一开始以为服务停止了,上服务器检查目标服务好好的活着.于是开始查原因. 一般来说目标积极拒绝(TCP 10061)的异常主要是2种可能: 1:服务器关机或者服务关闭 2:Client调用的端口错误或者服务器防火墙没开相应的端口 但是我们的服务本身是可以调用的,只是偶尔报这个错误,说明并不是这2个问题造成的.继续google,在stackove

Nine simple steps to enable X.509 certificates on WCF

Table of contents Introduction and goal Beginner WCF FAQs Step 1: Create client and server certificates Step 2: Copy the certificates in trusted people certificates Step 3: Specify the certification path and mode in the WCF service web.config file St

WCF简介

WCF是Windows Communication Foundation的缩写,是MS为SOA(Service Oriented Architecture 面向服务架构)而设计的一套完整的技术框架.WCF是Microsoft为构建面向服务的应用提供的分布式通信编程框架,使用该框架,开发人员可以构建跨平台.安全.可靠和支持事务处理的企业级互联应用解决方案. WCF 的基本概念是以契约(Contract) 来定义双方沟通的协议,主要包括四种契约:服务契约(Service Contract).数据契约

校园视频管理系统----EF+WCF+MVC实现SOA架构

元旦开始做视频管理系统,从需求调研,设计原型图到实体设计到现在的搭建框架,收获了很多,在团队合作中学习,交流,实践.这次的合作开发应用了一种新的框架----EF+WCF+MVC灵活的实现经典三层架构.初步学习,先简单介绍一下,如下图 左侧红色部分是三层架构,右侧是结合MVC+WCF+EF框架实现SOA. SOA:面向服务架构(Service Oriented Architecture),它属于一种组件架构模型,W3C的定义:一组公开发表接口,并且提供查询的组件,具有4个特性,每个服务具有明确的边

WCF入门教程(vs2010)

这几天挺别人提起WCF,鄙人之前只知道WPF,对WCF这个东东不甚了解,经过查阅网上的资料略有所得,和大家交流一下. 首先WCF是什么? Windows Communication Foundation(WCF)是由微软发展的一组数据通信的应用程序开发接口,可以翻译为Windows通讯接口.官方的定义就是这些,我们需要知道的就是他是一个通讯接口,直白的说就是用于两者之间联系的工具. 这里有人能想到这和webSerivice不是一样的吗?直接看官方的一些对WCF的描述我想你就明白了. 在 .NET

wcf之一

Wcf入门一 理解定义 理解soa(Service oriented architecture)服务 是指为了解决在Internet环境下业务集成的需要,通过连接能完成特定任务的独立功能实体实现的一种软件系统架构.SOA是一个组件模型,它将应用程序的不同功能单元(称为服务)通过这些服务之间定义良好的接口和契约联系起来. 理解wcf(Windows Communication Foundation) 是用于构建面向服务的应用程序的框架 ,是由微软发展的一组数据通信的应用程序开发接口. 简单例子 1