WCF Interview Questions – Part 4

By | November 30, 2012

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.

  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

What is SOA (Service Oriented Architecture) and how WCF supports it?

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.WCF as 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.
Back to top

What is ESB in SOA environment?

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 - WCF
Back to top

What is Transaction Propagation? And how WCF support it?

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.
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:

  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”.
Back to top

Does all WCF bindings support for Transaction Propagation?

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

  • wsHttpBinding
  • netTcpBinding
  • netNamedPipeBinding
  • wsDualHttpBinding
  • wsFederationHttpBinding

Back to top

What are the various Transaction Flow Options available in 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.

  • NotAllowed Transaction Propagation is not allowed for particular service method. Its default value.
  • Allowed Transaction Propagation is allowed but not compulsory.
  • Mandatory Transaction Propagation is compulsory for that service method.

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

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

Back to top

What is two-phase committed protocol?

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.

This is done in two phases:

  1. Prepare Phase
  2. Commit phaseTwo Phase Committed Protocol

Back to top

What is the role of transaction manager in 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.Transaction Manager in Two Phase Transaction Protocol
Back to top

What are the supported transaction types in WCF?

Supported transaction types in WCF are:

  • Light Weight
  • OLE Transactions
  • WS-Atomic Transactions

Back to top

How to enable the Performance Counters in WCF?

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

  <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”.

Previous: WCF Service FAQs Part-3

Top 10 Interview Questions and Answers Series:

Category: Uncategorized Tags: , ,

About IMRAN ABDUL GHANI

Imran Abdul Ghani is working as Software Developer(Senior) with extensive knowledge in Web development technologies especially C#, ASP.NET, MVC, WCF, Web API, ADO.NET Entity Framework, jQuery etc. He has several years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET (MCSD.NET) since 2005. You can reach his blogging at www.webdevelopmenthelp.net, www.topwcftutorials.net, and www.sharepointfordummies.net.