Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / XML
Technical Blog

WCF Service FAQs - Part 4

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
10 Oct 2013CPOL3 min read 10.7K   10  
This WCF service tutorial is part-4 in series of WCF Service FAQs.

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

  1. WCF Service FAQs - Part 1
  2. WCF Service FAQs - Part 2
  3. WCF Service FAQs - Part 3

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

What is ESB in an 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.

What is Transaction Propagation and how WCF supports 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:

C#
WSHttpBinding bindingBeingUsed = new WSHttpBinding();
bindingBeingUsed.TransactionFlow = "true";

Or it can be done decoratively by updating configuration file as follows:

XML
<bindings>
     <wsHttpBinding>
            <binding name="binding1"
                 transactionFlow="true" />
     </wsHttpBinding>
</bindings>

Default value for TransactionFlow property is "False".

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 

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.

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

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 i.e. Prepare phase and Commit phase.

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.

What are the supported transaction types in WCF?

Supported transaction types in WCF are:

  • Light Weight
  • OLE Transactions
  • WS-Atomic Transactions 

How to enable the Performance Counters in WCF?

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

XML
<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

Other WCF Service Tutorials

This article was originally posted at http://www.topwcftutorials.net/2012/11/WCF-FAQ-Part4.html

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Emaratech
United Arab Emirates United Arab Emirates
Imran Abdul Ghani has more than 10 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 WCF Tutorials, Web Development, SharePoint for Dummies.

Comments and Discussions

 
-- There are no messages in this forum --