WCF Interview Questions – Part 4

 

This WCF service tutorial is part-4 in series of WCF Interview Questions. Before reading this please go through the following articles in this series.

这是WCF问答教程的第四部分,在阅读之前请先去看下面列出来的文章。

  1. WCF Service Interview Questions – Part 1
  2. WCF Service Interview Questions – Part 2
  3. WCF Service Interview Questions – Part 3

WCF Interview Questions List – Part 4

  1. What is SOA (Service Oriented Architecture) and how WCF supports it?【什么是SOA(面向服务的架构),WCF是怎样支持它的。】
  2. What is ESB in SOA environment?【SOA环境中,什么是ESB】
  3. What is Transaction Propagation? And how WCF support it?【什么是事务传播,WCF是怎么支持它的?】
  4. Does all WCF bindings support for Transaction Propagation?【是不是所有的WCF绑定都支持事务传播?】
  5. What are the various Transaction Flow Options available in WCF?【WCF中可用的各种事务流选项是什么?】
  6. What is two-phase committed protocol?【什么是Two-Phase提交协议?】
  7. What is the role of transaction manager in WCF?【WCF中,事务管理器的作用是什么?】
  8. What are the supported transaction types in WCF?【WCF支持哪些事务类型?】
  9. How to enable the Performance Counters in WCF?【如何启用WCF的性能计数器?】

What is SOA (Service Oriented Architecture) and how WCF supports it?【什么是SOA(面向服务的架构),WCF是怎样支持它的。】

SOA is basically an architectural model that dictates few principles for building business applications in the form of independent, loosely coupled and interoperable services. These services are well defined, self-contained and can work together to achieve certain business functionality without depending on context or state of other services.

SOA是一种架构模型,它规定了一些原则,来创建形式独立的,松耦合的,可互操作的业务应用程序。这些定义非常好的,独立的服务,可以相互工作,达到某种业务功能,而不需要依赖上下文,或者其他服务的状态。

WCF supports almost all those principles dictated by Service Oriented Architecture for developing services; those are independent, loosely coupled and interoperable also. Please visit for detailed discussion on WCF and SOA.
WCF几乎支持所有面向服务架构的原则,用来开发服务。他们是独立的,松耦合的,同样也是可互操作的,想要了解更多详细的讨论,请看WCF and SOA.

What is ESB in SOA environment?【SOA环境中,什么是ESB】

In Service Oriented Architecture environment, ESB (Enterprise Service Bus) acts as a single interface for all messaging between applications and services in a loosely coupled manner. ESB is capable to call and subscribe different service provider’s methods and subscriptions respectively.

在面向服务的架构的环境中,ESB(企业服务总线)作为一个接口,为所有在应用程序和服务之间的消息传递,以一种松耦合的方式传递。ESB可以调用和区别不同的服务提供商的方法。

What is Transaction Propagation? And how WCF support it?【什么是事务传播,WCF是怎么支持它的?】

Transaction propagation is the ability to propagate transaction across the boundaries of a single service. Or in other words, we can say that a service can participate in a transaction that is initiated by a client.
In a SOA environment, transaction propagation becomes a key requirement. As we know that WCF supports SOA, so it provides support for transaction propagation as well.

事务传播就是在单个服务的界限间传播事务的能力。或者换句话说,一个服务可以加入到一个由客户端发起的事务中。在SOA的环境中,事务传播成为了一个关键的必须点。我们知道,WCF支持SOA,所以WCF同样支持事务传播。
To enable transaction propagation, we need to set the value of TransactionFlow property of the binding being used. This can be done programmatically as follows:

为了启动事务传播,我们需要设置所绑定的TransactionFlow 属性值,下面是具体的做法:

  WSHttpBinding bindingBeingUsed = new WSHttpBinding();
  bindingBeingUsed.TransactionFlow = “true”;

Or It can be done declaratively by updating configuration file as follows:

或者可以通过修改配置文件,来启用事务传播,例如下面:

  <bindings>
      <wsHttpBinding>
               <binding name=”binding1”
                                   transactionFlow=”true” />
       </wsHttpBinding>
   </bindings>

Default value for TransactionFlow property is “False”.【默认的TransactionFlow 属性值是false】

Does all WCF bindings support for Transaction Propagation? 【是不是所有的WCF绑定都支持事务传播?】

No. Not all WCF bindings support transaction propagation. Only following list of bindings support for it.

不是的,并不是所有的WCF绑定都支持事务传播,仅仅只有下面列出来的绑定支持事务传播。

  • wsHttpBinding
  • netTcpBinding
  • netNamedPipeBinding
  • wsDualHttpBinding
  • wsFederationHttpBinding

What are the various Transaction Flow Options available in WCF?【WCF中可用的各种事务流选项是什么?】

If a service is configured for Transaction Propagation, WCF further supports various options for service methods to be part of any transaction initiated outside service boundaries.

如果为服务配置事务传播,在服务边界之外,WCF将进一步支持服务的各种方法。

  • NotAllowed Transaction Propagation is not allowed for particular service method. Its default value.
       NotAllowed 不允许应用于特别的服务方法,这是默认值。
  • Allowed Transaction Propagation is allowed but not compulsory.
        Allowed ,允许,但不是强制的。
  • Mandatory Transaction Propagation is compulsory for that service method.
       Mandatory 强制的,对于服务方法来说是强制的

For example, Transaction Propagation is mandatory for CreditAccount service method in following code snippet.

例如下面的代码片段中,为CreditAccount服务方法设置事务的选项为强制的。

   [ServiceContract]
   interface IPaymentService
   {
              [OperationContract]
              [TransactionFlow(TransactionFlowOption.Mandatory)]
              void CreditAccount(….);
   }

What is two-phase committed protocol?【什么是Two-Phase提交协议?】

In a distributed transaction scenario, two-phase committed protocol is an algorithm that ensures all the participating processes in a distributed transaction are ready to be committed or roll backed.

在分布式的场景中,two-phase committed protocol是一种算法,它确保所有的流程参与到分布式的提交或者回滚中。

This is done in two phases:

  1. Prepare Phase
  2. Commit phase

What is the role of transaction manager in WCF? 【WCF中,事务管理器的作用是什么?】

Transaction manager while sitting on client side, initiate the transaction and coordinates with all the processes that participate in a distributed transaction to commit or roll back.

事务管理是在客户端设置的,它负责启动事务,并且协调所有参与到分布式中的进程,是提交或者是回滚。

What are the supported transaction types in WCF?【WCF支持哪些事务类型?】

Supported transaction types in WCF are:【WCF支持的事务类型有:】

  • Light Weight【轻量级的】
  • OLE Transactions【OLE事务】
  • WS-Atomic Transactions【WS-Atomic事务】

How to enable the Performance Counters in WCF?【如何启用WCF的性能计数器?】

Simple way to enable Performance Counters supported by WCF is as follows:

简单的方式来启动WCF性能计数器,如下:

  <system.serviceModel>
                 <diagnostics performanceCounters = “All” />
</system.serviceModel>

Above configuration setting will enable all categories of counters including ServiceModelService, ServiceModelEndpoint and ServiceModelOperation. Default value for it is “Off”.

上面的设置,将会启动所有种类的计数器,包括:ServiceModelService,ServiceModelEndpoint 和ServiceModelOperation,默认它的值是OFF。

WCF学习系列四--【WCF Interview Questions – Part 4 翻译系列】的更多相关文章

  1. WCF学习系列二---【WCF Interview Questions – Part 2 翻译系列】

    http://www.topwcftutorials.net/2012/09/wcf-faqs-part2.html WCF Interview Questions – Part 2 This WCF ...

  2. WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】

    http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...

  3. WCF学习之旅—WCF服务部署到IIS7.5(九)

    上接   WCF学习之旅—WCF寄宿前的准备(八) 四.WCF服务部署到IIS7.5 我们把WCF寄宿在IIS之上,在IIS中宿主一个服务的主要优点是在发生客户端请求时宿主进程会被自动启动,并且你可以 ...

  4. WCF学习之旅—WCF第二个示例(五)

    二.WCF服务端应用程序 第一步,创建WCF服务应用程序项目 打开Visual Studio 2015,在菜单上点击文件—>新建—>项目—>WCF服务应用程序.在弹出界面的“名称”对 ...

  5. WCF学习之旅—WCF第二个示例(七)

    三.创建客户端应用程序 若要创建客户端应用程序,你将另外添加一个项目,添加对该项目的服务引用,配置数据源,并创建一个用户界面以显示服务中的数据. 在第一个步骤中,你将 Windows 窗体项目添加到解 ...

  6. WCF学习之旅—WCF第二个示例(六)

    第五步,创建数据服务 在“解决方案资源管理器”中,使用鼠标左键选中“SCF.WcfService”项目,然后在菜单栏上,依次选择“项目”.“添加新项”. 在“添加新项”对话框中,选择“Web”节点,然 ...

  7. WCF学习之旅—WCF服务部署到应用程序(十)

    上接  WCF学习之旅—WCF寄宿前的准备(八) WCF学习之旅—WCF服务部署到IIS7.5(九) 五.控制台应用程序宿主 (1) 在解决方案下新建控制台输出项目 ConsoleHosting.如下 ...

  8. WCF学习之旅—WCF服务的Windows 服务程序寄宿(十一)

    上接    WCF学习之旅—WCF服务部署到IIS7.5(九) WCF学习之旅—WCF服务部署到应用程序(十) 七 WCF服务的Windows 服务程序寄宿 这种方式的服务寄宿,和IIS一样有一个一样 ...

  9. WCF学习之旅—WCF服务的WAS寄宿(十二)

    上接    WCF学习之旅—WCF服务部署到IIS7.5(九) WCF学习之旅—WCF服务部署到应用程序(十) WCF学习之旅—WCF服务的Windows 服务程序寄宿(十一) 八.WAS宿主 IIS ...

随机推荐

  1. CSDN:你认为一名优秀的技术人应该具备怎样的素质?

    CSDN:你认为一名优秀的技术人应该具备怎样的素质? 王晶昱:我个人认为,符合这个世界要求的就是优秀的.在目前这个时代,我认为一个优秀的技术人员的特质可能是: 兴趣驱动,兴趣是最好的老师,写程序本身就 ...

  2. C# Winform中如何让PictureBox的背景透明

    最近做winform程序,其中有个需求:有两个PictureBox完全重叠,上面一个需要透明,不能遮挡下面的,以为设置上面的BackColor为透明色就可以了,结果不行,上网搜了一下,发现对于我这种需 ...

  3. .Net组件程序设计之序列化

     .Net组件程序设计之序列化 自动序列化 本篇给大家讲解一下在.NET中的序列化,它的用处非常之多,特别是对于某种环境下保存某种状态是很好的方法,接下来就来看一下吧. Serializable属性 ...

  4. 巧用transform实现HTML5 video标签视频比例拉伸

    前言 原文地址 曾几何时,项目中有碰到视频比例拉伸的需求,但是发现这个看似再普通不过的一个需求,找遍全网至今都没有找到解决方法.因为强制给video标签设置width和height的话只会将video ...

  5. Git 进阶指南

    转自: https://github.com/kaiye/kaiye.github.com/issues/7 在掌握了基础的 Git 使用 之后,可能会遇到一些问题.以下是猫哥筛选总结的部分常见问题, ...

  6. 开源一个练手小App, PrintableCheckList

    A small but powerful App, only focus on one thing, make you easy to print out your checklist. It is ...

  7. PMO是什么?如何与其他部门协作配合提高项目成功率?

    许多公司里,有许多IT项目,特别是在软件公司里,许多开发团队并没有运用灵敏开发来进行项目办理.在某些状况下,尤其在一些公司里IT不是很受注重的,只能作为一个事务支撑部分,灵敏团队面对的首要疑问,是缺少 ...

  8. WebApi系列~目录

    回到占占推荐博客索引 写了这个系列的文章不少了,也应该为大家写个目录了,最近很刮了很多SOA的风,很多企业都将自己的系统进行分割,通常是按模块进行拆分,为这个模块提供统一的接口提供业务服务,这不紧可以 ...

  9. MongoDB学习笔记~根据子集合里某个属性排序

    回到目录 这个问题是这样的,有一个实体dog,里面有集合属性DogHistory,它里面有一些自己的属性,其中一个是SortNum,主要用来进行排序,而且这个排序可以影响主对象,即影响dog类,这个在 ...

  10. 获取bing.com的图片并在gnome3中设置自动切换

    发现 bing.com 上的图片很好看,因此打算每天把 bing.com 的图片下载下来,用作桌面. 需要做的是两个部分,爬取图片到目录和设置目录图片为桌面背景并可以自动切换. 第一部分,下载图片,使 ...