WCF学习系列一【WCF Interview Questions-Part 1 翻译系列】
WCF Interview Questions – Part 1
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]:常见问答
- What is WCF?【什么是WCF】
- Why to use WCF? or What are the advantages of using WCF?【为什么要使用WCF,或者WCF有哪些优点】
- What are the core components of WCF Service?【WCF服务,核心的组件是?】
- What are the new features introduced in WCF 4.5?【WCF 4.5版本中介绍了哪些新特性】
- What is the difference between WCF and ASMX Web services?【WCF和ASMX Web服务之间的不同是什么?】
- What are the Endpoints in WCF? or Explain ABCs of endpoint?【WCF的节点是什么?或者解释一两点出来】
- What is the difference between Service EndPoint and Client Endpoint?【服务节点和客户端节点有什么不同?】
- What is a WCF Binding? How many different types of bindings available in WCF?【什么是WCF绑定,WCF中允许哪些类型的绑定?】
- What is WebHttpBinding in WCF?【WCF中WebHttpBinding是什么?】
- Can we have multiple endpoints for different binding types in order to serve different types of clients?【为了服务不同类型的客户端,我们可以有多个不同类型的绑定节点么?】
- What are the hosting options for WCF Services? Explain.【WCF的托管选项是什么?请解释。】
What is WCF?【什么是WCF】
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,下面的图表清晰的解释了:
Why to use WCF? or What are the advantages of using WCF?
支持面向服务的架构;简单、可靠、安全;便于协同操作;一个服务可以服务多个客户端;可扩展。
- Service Orientation is one of the key advantages of WCF. We can easily build service-oriented applications using WCF.【面向服务是WCF关键的优点。我们使用WCF可以很简单的构建面向服务的应用程序。】
- If compared with ASMX web services, WCF service provides reliability and security with simplicity.【和ASMX Web 服务相比,WCF服务提供了可靠性,安全性,简单性】
- As oppose to .NET Remoting, WCF services are interoperable.【相对.NET Remoting,WCF服务是可以互操作的。】
- Different clients can interact with same service using different communication mechanism. This is achieved by using service endpoints. A single WCF service can have multiple endpoints. So, developer will write code for service once and just by changing configuration (defining another service endpoint), it will be available for other clients as well.【不同的客户端,和同一个服务的交互,可以使用不同的通信机制。这可以通过使用服务节点实现。一个简单的WCF服务可以有多个节点。因此,开发者只需要写一次服务端的代码,然后仅仅通过改变配置(定义其他的服务节点),那么这个服务,将会同时可以被其他的客互端使用。】
- Extensibility is another key advantage of WCF. We can easily customize a service behavior if required.【可扩展是WCF另外一个关键性的优点,如果有需要的话,我们可以很简单的定制服务的行为。】
What are the core components of WCF Service?【WCF的关键组件是什么】
- Service Class: A service class implementing in any CLR-based language and expose at least one method.
- Hosting Environment: a managed process for running service.
- Endpoint: a client uses it to communicate with service.
What are the new features introduced in WCF 4.5?【WCF 4.5版本中介绍了哪些新特性】
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发布了一些很酷的特点。这里我们仅仅列出最重要的特点,但是你可以从这篇文章中7parts series of new features in WCF 4.5.找到每个特性的深入细节的代码片段。这些重要的特性是:
- Simplified Configuration files【简化的配置文件】
- ToolTip and Intellisense support【工具提示和智能感知的支持】
- Task-based asynchronous Programming Model【基于任务的异步编程模型】
- BasicHttpsBinding support【BasicHttpsBinding支持】
- Single WSDL Document【单个的WSDL文件】
- WCF Configuration Validation【WCF配置验证】
- ASP.NET Compatibility Mode changed【ASP.NET兼容模型改变】
- Contract First Development【Contract First开发】
- Multiple Authentication Types【多个身份验证类型】
- XmlDictionaryReaderQuotas default value changed【XmlDictionaryReaderQuotas默认值改变】
- UDP Transport Support【支持UDP传输】
- and many more…【更多....】
For more on key WCF 4.5 features, please follow here.【想要了解更多WCF 4.5的特性,请看这: follow here】
What is the difference between WCF and ASMX Web services?【WCF和ASMX Web服务之间的不同是什么?】
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服务的讨论。
What are the Endpoints in WCF? or Explain ABCs of endpoint?【WCF的节点是什么?或者解释一两点出来】
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.
- Address: It defines “WHERE”. Address is the URL that identifies the location of the service.
- Binding: It defines “HOW”. Binding defines how the service can be accessed.
- Contract: It defines “WHAT”. Contract identifies what is exposed by the service.
What is the difference between Service EndPoint and Client Endpoint?【服务端节点和客户端节点有什么不同?】
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.【和服务通信的时候传递,期望值】 |
What is a WCF Binding? How many different types of bindings available in WCF?【什么是WCF绑定,WCF中允许哪些类型的绑定?】
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中,都是可行的,每一个都是实现一些特定的需要。
- basicHttpBinding
- wsHttpBinding
- netNamedPipeBinding
- netTcpBinding
- netPeerTcpBinding
- netmsmqBinding
For details on different binding types, please follow the link to WCF bindings.
想要了解很多不同的绑定类型,请看这个链接的文章:WCF bindings.
What is a WebHttpBinding in WCF?【WCF中WebHttpBinding是什么?】
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 。
Can we have multiple endpoints for different binding types in order to serve different types of clients?【为了服务不同类型的客户端,我们可以有多个不同类型的绑定节点么?】
Yes, we can have multiple endpoints for different binding types. For example, an endpoint with wsHttpBinding and another one with netTcpBinging.
是的,对于不用的绑定类型,我们可以有多个节点。例如一个节点上带有wsHttpBinding ,另外一个节点上有netTcpBinging。
What are the hosting options for WCF Services? Explain.【WCF的托管选项是什么?请解释。】
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实例和一个节点配置。,下面的这些都是可以为服务托管的方法:
- Hosting in a Managed Application/ Self Hosting【托管在一个托管的应用程序中/自我托管】
- Console Application【控制台应用程序】
- Windows Application【窗体应用程序】
- Windows Service【Windows服务】
- Hosting on Web Server【托管在Web服务器上】
- IIS 6.0 (ASP.NET Application supports only HTTP)【IIS 6.0 ASP.NET应用程序仅仅支持HTTP】
- Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP,【窗体进程激活服务(WAS),例如IIS 7.0 支持 HTTP,TCP,NamedPipes, MSMQ】
NamedPipes, MSMQ.
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 翻译系列】的更多相关文章
- WCF学习系列二---【WCF Interview Questions – Part 2 翻译系列】
http://www.topwcftutorials.net/2012/09/wcf-faqs-part2.html WCF Interview Questions – Part 2 This WCF ...
- WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】
http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...
- WCF学习系列四--【WCF Interview Questions – Part 4 翻译系列】
WCF Interview Questions – Part 4 This WCF service tutorial is part-4 in series of WCF Interview Qu ...
- WCF学习之旅—WCF服务部署到IIS7.5(九)
上接 WCF学习之旅—WCF寄宿前的准备(八) 四.WCF服务部署到IIS7.5 我们把WCF寄宿在IIS之上,在IIS中宿主一个服务的主要优点是在发生客户端请求时宿主进程会被自动启动,并且你可以 ...
- WCF学习之旅—WCF服务部署到应用程序(十)
上接 WCF学习之旅—WCF寄宿前的准备(八) WCF学习之旅—WCF服务部署到IIS7.5(九) 五.控制台应用程序宿主 (1) 在解决方案下新建控制台输出项目 ConsoleHosting.如下 ...
- WCF学习之旅—WCF服务的Windows 服务程序寄宿(十一)
上接 WCF学习之旅—WCF服务部署到IIS7.5(九) WCF学习之旅—WCF服务部署到应用程序(十) 七 WCF服务的Windows 服务程序寄宿 这种方式的服务寄宿,和IIS一样有一个一样 ...
- WCF学习之旅—WCF服务的WAS寄宿(十二)
上接 WCF学习之旅—WCF服务部署到IIS7.5(九) WCF学习之旅—WCF服务部署到应用程序(十) WCF学习之旅—WCF服务的Windows 服务程序寄宿(十一) 八.WAS宿主 IIS ...
- WCF学习之旅—WCF服务的批量寄宿(十三)
上接 WCF学习之旅—WCF服务部署到IIS7.5(九) WCF学习之旅—WCF服务部署到应用程序(十) WCF学习之旅—WCF服务的Windows 服务程序寄宿(十一) WCF学习之旅—WCF ...
- WCF学习之旅—WCF第二个示例(五)
二.WCF服务端应用程序 第一步,创建WCF服务应用程序项目 打开Visual Studio 2015,在菜单上点击文件—>新建—>项目—>WCF服务应用程序.在弹出界面的“名称”对 ...
- WCF学习之旅—WCF第二个示例(七)
三.创建客户端应用程序 若要创建客户端应用程序,你将另外添加一个项目,添加对该项目的服务引用,配置数据源,并创建一个用户界面以显示服务中的数据. 在第一个步骤中,你将 Windows 窗体项目添加到解 ...
随机推荐
- 【微信小程序开发】之如何获取免费ssl证书【图文步骤】
微信小程序要求所有网络请求都走ssl加密,因此我们开发服务端接口需要配置为https 这篇文章介绍一下如何 在 startssl 申请一个免费的ca证书. 1. 打开网站 https://www.s ...
- “老坛泡新菜”:SOD MVVM框架,让WinForms焕发新春
火热的MVVM框架 最近几年最热门的技术之一就是前端技术了,各种前端框架,前端标准和前端设计风格层出不穷,而在众多前端框架中具有MVC,MVVM功能的框架成为耀眼新星,比如GitHub关注度很高的Vu ...
- Android中访问sdcard路径的几种方式
以前的Android(4.1之前的版本)中,SDcard路径通过"/sdcard"或者"/mnt/sdcard"来表示,而在JellyBean(安卓4.1)系统 ...
- iOS从零开始学习直播之1.播放
对于直播来说,客户端主要做两件事情,推流和播放.今天先讲播放. 播放流程 1.拉流:服务器已有直播内容,从指定地址进行拉取的过程.其实就是向服务器请求数据. 2.解码:对视屏数据进行解压缩. 3. ...
- VMware下对虚拟机Ubuntu14系统所在分区sda1进行磁盘扩容
VMware下对虚拟机Ubuntu14系统所在分区sda1进行磁盘扩容 一般来说,在对虚拟机里的Ubuntu下的磁盘进行扩容时,都是添加新的分区,而并不是对其系统所在分区进行扩容,如在此链接中http ...
- zookeeper(单机/集群)安装与配置
一.安装与单机配置 1.下载: wget http://archive.apache.org/dist/zookeeper/stable/zookeeper-3.4.6.tar.gz 如果网站下载不了 ...
- 【每日一linux命令1】linux命令路径
一.路径: 执行命令前必须要考虑的一步是命令的路径,若是路径错误或是没有正确的指定,可能导致错误 的执行或是找不到该命令.要知道设置的路径,可执行以下命令: echo $PATH 显示结果: 这时我们 ...
- 关押罪犯 and 食物链(并查集)
题目描述 S 城现有两座监狱,一共关押着N 名罪犯,编号分别为1~N.他们之间的关系自然也极不和谐.很多罪犯之间甚至积怨已久,如果客观条件具备则随时可能爆发冲突.我们用"怨气值"( ...
- [Xamarin] 透過Native Code呼叫 JavaScript function (转帖)
今天我們來聊聊關於如何使用WebView 中的Javascript 來呼叫 Native Code 的部分 首先,你得先來看看這篇[Xamarin] 使用Webview 來做APP因為這篇文章至少講解 ...
- .NET面试题系列[4] - C# 基础知识(2)
2 类型转换 面试出现频率:主要考察装箱和拆箱.对于有笔试题的场合也可能会考一些基本的类型转换是否合法. 重要程度:10/10 CLR最重要的特性之一就是类型安全性.在运行时,CLR总是知道一个对象是 ...