WCF stands for Windows Communication Foundation.
The elementary feature of WCF is interoperability. It is one of the latest technologies of Microsoft that is used to build service-oriented applications.
wcf的基础特性是互操作性,它是微软最新的一项技术,用来生成面向服务的应用。
Based on the concept of message-based communication, in which an HTTP request is represented uniformly, WCF makes it possible to have a unified API irrespective of diverse transport mechanisms.
根据"基于消息的通信"的概念,在统一采用http请求的情况下,WCF使得拥有一个统一的API变得可能,而不用考虑不同的传输机制 API--Application Programming Interface
elementary 基本的;初级的;[化学] 元素的
interoperability互操作性;互用性
uniformly一致地
unified统一的;一致标准的
irrespective无关的;不考虑的;不顾的
diverse不同的;多种多样的;变化多的
WCF was released for the first time in 2006 as a part of the .NET framework with Windows Vista, and then got updated several times. WCF 4.5 is the most recent version that is now widely used.
WCF在2006年第一次发布,作为Vista操作系统中.net framework的一部分。之后wcf更新了几次。WCF4.5是最新的版本,并且现在使用的最为广泛。
A WCF application consists of three components: WCF应用由三部分组成
- WCF service, WCF服务
- WCF service host, and WCF主机
- WCF service client. WCF客户端
WCF platform is also known as the Service Model. WCF品台也被称为服务模块
Fundamental Concepts of WCF WCF基本的概念
Message 消息
This is a communication unit that comprises of several parts apart from the body. Message instances are sent as well as received for all types of communication between the client and the service.
这是一个通信单元,由除了body之外的几个部分组成。 消息实例在客户端与服务端的所有类型的通信中被发送和接收。
Endpoint 终结点
It defines the address where a message is to be sent or received. It also specifies the communication mechanism to describe how the messages will be sent along with defining the set of messages. A structure of an endpoint comprises of the following parts:
Endpoint定义了一个消息发往或者接收的地址。它还指定了通信机制来描述消息如何和被定义的信息一起发送。endpoint结构由以下几个部分组成
-
Address - Address specifies the exact location to receive the messages and is specified as a Uniform Resource Identifier (URI). It is expressed as scheme://domain[:port]/[path]. Take a look at the address mentioned below:
net.tcp://localhost:9000/ServiceA
Here, 'net.tcp' is the scheme for the TCP protocol. The domain is 'localhost' which can be the name of a machine or a web domain, and the path is 'ServiceA'.
地址:Address 指定了准确的位置来接收消息,并将这个位置命名为url。用 acheme://domain[:port]/[path]来表示,看一下下面提到的地址:
net.tcp://localhost:9000/ServiceA
这里,'net.tcp'是TCP协议模式,域名localhost可以是一个机器或者网络域,路径是ServiceA
Binding - It defines the way an endpoint communicates. It comprises of some binding elements that make the infrastructure for communication. For example, a binding states the protocols used for transport like TCP, HTTP, etc., the format of message encoding, and the protocols related to security as well as reliability.
绑定 :Binding定义了终结点的通讯方式。它由一些绑定元素构成,这些元素构成了通讯的底层结构。例如,一个binding声明了用于传输的协议,例如TCP,HTTP等,消息的编码格式,和协议相关的安全性以及可靠性
Contracts - It is a collection of operations that specifies what functionality the endpoint exposes to the clinet. It generally consists of an interface name.
契约:它是一系列操作的集合,这些操作指定了endpoint公开给客户端的功能。它通常由一个接口名称构成。
Hosting 托管
Hosting from the viewpoint of WCF refers to the WCF service hosting which can be done through many available options like self-hosting, IIS hosting, and WAS hosting.
从WCF的视角来看Hosting,它涉及到WCF托管服务,托管服务可以通过通过许多选择来完成,例如self-hosting, IIS hosting, and WAS hosting.
Metadata 元数据
This is a significant concept of WCF, as it facilitates easy interaction between a client application and a WCF service. Normally, metadata for a WCF service is generated automatically when enabled, and this is done by inspection of service and its endpoints.
metadata是WCF中的一个重要概念,因为它促进了客户度应用和WCF服务之间的简单互动。通常,在允许的情况下,WCF的元数据是自动生成的,这是通过检查服务以及终结点来完成的。
facilitate促进
WCF Client
A client application that gets created for exposing the service operations in the form of methods is known as a WCF client. This can be hosted by any application, even the one that does service hosting.
客户端应用被创建,以方法的形式来公开服务操作,客户端应用也被称为WCF客户端。 这可以由任务应用来托管,即使是托管服务的应用也可以。
Channel
Channel is a medium through which a client communicates with a service. Different types of channels get stacked and are known as Channel Stacks.
信道是客户端和服务进行通信的中介。不同类型的信道get stacked,也被称为信道栈。
SOAP
Although termed as ‘Simple Object Access Protocol’, SOAP is not a transport protocol; instead it is an XML document comprising of a header and body section.
soap也被称为"Simple Object Access Protocol"简单对象访问协议,soap不是一个传输协议。相反,它是一个由header以及body部分构成的xml文档。
Advantages of WCF WCF的优点
It is interoperable with respect to other services. This is in sharp contrast to .NET Remoting in which both the client and the service must have .Net.
WCF services offer enhanced reliability as well as security in comparison to ASMX (Active Server Methods) web services.
Implementing the security model and binding change in WCF do not require a major change in coding. Just a few configuration changes is required to meet the constraints.
WCF has built-in logging mechanism whereas in other technologies, it is essential to do the requisite coding.
WCF has integrated AJAX and support for JSON (JavaScript object notation).
It offers scalability and support for up-coming web service standards.
It has a default security mechanism which is extremely robust.
1.相对其他服务而言,wcf是可以彼此协作的。这和.net远程形成了鲜明的对比,.net远程要求客户端和服务端必须由.net环境。
2.和ASMX网络服务相比,WCF服务提供了增强的可靠性以及安全性
3.实现了安全模型,将变化绑定至WCF无需在代码上进行大的改动。仅需要配置做一些改变就可以达到约束的要求
4.WCF有内置的日志机制,然而在其他技术中,为此编码是必不可少的
5.WCF集成了AJAX并且支持json
6.它为即将到来的web服务标准提供了可扩展性与支持
7.它有默认的安全机制,并且这个安全机制及其稳健
interoperable彼此协作的;能共同操作的;能共同使用的