标签:
This WCF Tutorial is a collection of most frequently asked interview questions about Windows Communication Foundation (WCF) covering the beginner to professional level.
这个WCF教程,是WCF常见问题的集合,它主要面向WCF初学者的专业水平。
Following are the links to other posts in this WCF Questions Series:
下面是WCF系列问答教程中的一部分:
- WCF Service Interview Questions – Part 1
- WCF Service Interview Questions – Part 2
- WCF Service Interview Questions – Part 3
- WCF Service Interview Questions – Part 4
Note: Please look into the Top 10 WCF Interview Questions also.
注意:同时请关注前10个WCF问题: Top 10 WCF Interview Questions
frequently asked questions[FAQ]:常见问答
Microsoft refers WCF as a programming platform that is used to build Service-Oriented applications. Windows Communication Foundation is basically a unified programming model for developing, configuring and deploying distributed services. Microsoft has unified all its existing distributed application technologies (e.g. MS Enterprise Services, ASMX web services, MSMQ, .NET Remoting etc) at one platform i.e. WCF. Code name for WCF was Indigo. Below diagram clearly explains it:
微软把WCF作为,用于构建面向服务的应用程序的编程平台。Windows Communication Foundation基本上是一个统一的编程模型开发、配置和部署分布式服务。微软统一了现有的分布式应用程序【例如MS Enterprise Services, ASMX web services, MSMQ, .NET Remoting 等等】集中在一个平台上,也就是WCF。为WCF取名为Indigo,下面的图表清晰的解释了:
支持面向服务的架构;简单、可靠、安全;便于协同操作;一个服务可以服务多个客户端;可扩展。
Windows Communication Foundation v4.5 was released with a number of cool features. Here we simply list down most important features but you can find thorough detail about each feature with helping code snippet in 7 parts series of new features in WCF 4.5. These important features are:
Windows Communication Foundation v4.5发布了一些很酷的特点。这里我们仅仅列出最重要的特点,但是你可以从这篇文章中7 parts series of new features in WCF 4.5.找到每个特性的深入细节的代码片段。这些重要的特性是:
For more on key WCF 4.5 features, please follow here.【想要了解更多WCF 4.5的特性,请看这: follow here】
The basic difference is that ASMX web service is designed to send and receive messages using SOAP over HTTP only. While WCF service can exchange messages using any format (SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, Named Pipes etc).You can find detailed discussion on WCF Vs ASMX Web services here.
基本区别是,ASMX web服务是使用HTTP上的SOAP,仅仅用于发送和接收消息。而WCF可以在任何传输协议(HTTP, TCP/IP, MSMQ, Named Pipes etc)上,使用任何格式(默认是SOAP)交换信息。在这儿,WCF Vs ASMX Web services ,你可以找到更多关于WCF和ASMX Web服务的讨论。
For WCF services to be consumed, it’s necessary that it must be exposed; Clients need information about service to communicate with it. This is where service endpoints play their role.
随着WCF讨论的继续,很有必要弄清楚什么是WCF;客户端需要服务的信息来通信,这就是服务节点所扮演的角色。
A service endpoint has three basic elements or also called ABCs of an endpoint i.e. Address, Binding and Contract.
一个服务节点有三个基本的元素,或者称作ABCs节点,那就是Address, Binding and Contract.
As we already understood the concept of an Endpoint and it’s ABC (Address, Binding, Contract). Both Service and Client Endpoint has same ABC but we think in different perspective while working with them. We can differentiate between Service and Client Endpoint with respect to Address, Binding and Contract as:
我们已经理解了节点的概念,知道了它有ABCs-->【Address, Binding, Contract】,服务端节点和客户端节点都同样有ABCs,但是我们可以从不同的角度来思考、使用它们。我们可以根据 Address, Binding and Contract,从以下几个方面来区分服务端节点和客户端节点:
Service Endpoint【服务端节点】 |
Client Endpoint【客户端节点】 |
WHERE: URL of hosted service.【托管服务的URL】 | WHERE: where to connect with hosted service.【连接托管服务】 |
WHAT: bindings being used.【使用绑定】 | WHAT: binding supported by service.【服务支持的绑定】 |
CONTRACT: Service Contract i.e. interfaces【服务契约,例如接口。】 | CONTRACT: what to pass and expect while communicating with service.【和服务通信的时候传递,期望值】 |
Bindings in WCF actually defines that how to communicate with the service. Binding specifies that what communication protocol as well as encoding method will be used. Optionally, binding can specify other important factors like transactions, reliable sessions and security.
Another WCF Tutorial gives more detailed understanding of Binding concept in WCF.
There are different built-in bindings available in WCF, each designed to fulfill some specific need.
WCF中的Bindings,实际上定义了如何与服务进行通信.绑定指定了通信的协议还有使用的编码的方法。可选地,Binding可以指定其他重要因素,如事务,可靠的Sessions和安全性。另外的一片文章:WCF Tutorial给出了更多WCF中Binding概念的细节。
下面这些不同的内置绑定在WCF中,都是可行的,每一个都是实现一些特定的需要。
For details on different binding types, please follow the link to WCF bindings.
想要了解很多不同的绑定类型,请看这个链接的文章:WCF bindings.
WebHttpBinding is the one that is used for creating WCF RESTful services. In Windows Communication Foundation v3.5, Microsoft introduces support for building RESTful services. REST (Representational State Transfer) is an architectural design that uses HTTP the way it should be used.
WebHttpBinding 被用来创建:WCF RESTful services,在WCF 3.5中,微软就支持创建RESTful 服务。REST (Representational State Transfer)是一个使用HTTP的设计结构。
Instead of using HTTP just as a transport (in case of SOAP-based WCF Services), RESTful WCF services uses full features of HTTP (for all CRUD Operations including Create, Retrieve, Update and Delete).
You can find WebHttpBinding in action as in below configuration screenshot.
代替使用HTTP作为运输(在基于SOAP的WCF下), RESTful WCF services uses full features of HTTP(可以做所有的CRUD操作,包括增删查改。)你可以在下面的配置中找到WebHttpBinding 。
Yes, we can have multiple endpoints for different binding types. For example, an endpoint with wsHttpBinding and another one with netTcpBinging.
是的,对于不用的绑定类型,我们可以有多个节点。例如一个节点上带有wsHttpBinding ,另外一个节点上有netTcpBinging。
For a service to host, we need at least a managed process, a ServiceHost instance and an Endpoint configured. Possible approaches for hosting a service are:
对于一个服务托管,我们至少需要一个管理进程,ServiceHost实例和一个节点配置。,下面的这些都是可以为服务托管的方法:
Next WCF Tutorial on Interview Questions and Answers in this series is about Proxy and Channel Factory, Concurrency and Throttling in WCF.
下一篇WCF系列教程中,将会说道代理,渠道工厂,WCF的并发性和节流。
WCF学习系列一【WCF Interview Questions-Part 1 翻译系列】
标签:
原文地址:http://www.cnblogs.com/caofangsheng/p/5492287.html