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 Interview Questions List – Part 4
- What is SOA (Service Oriented Architecture) and how WCF supports it?
- What is ESB in SOA environment?
- What is Transaction Propagation? And how WCF support it?
- Does all WCF bindings support for Transaction Propagation?
- What are the various Transaction Flow Options available in WCF?
- What is two-phase committed protocol?
- What is the role of transaction manager in WCF?
- What are the supported transaction types in WCF?
- How to enable the Performance Counters in 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.
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
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.
Back to top
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:
bindingBeingUsed.TransactionFlow = “true”;
Or It can be done declaratively by updating configuration file as follows:
Default value for TransactionFlow property is “False”.
Back to top
No. Not all WCF bindings support transaction propagation. Only following list of bindings support for it.
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.
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:
- Prepare Phase
- Commit phase
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.
Back to top
Supported transaction types in WCF are:
- Light Weight
- OLE Transactions
- WS-Atomic Transactions
Simple way to enable Performance Counters supported by WCF is as follows:
<diagnostics performanceCounters = “All” />
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:
- Top 10 WCF Interview Questions
- Comprehensive Series of WCF Interview Questions
- Top 10 HTML5 Interview Questions
- Top 10 ASP.NET Interview Questions
- Comprehensive Series of ASP.NET Interview Questions
- Top 10 ASP.NET MVC Interview Questions
- Top 10 ASP.NET Web API Interview Questions
- Top 10 ASP.NET AJAX Interview Questions