In this section we will look at the WCF technology.
What is it?
Windows Communication Foundation (WCF) is a framework level technology that is a part of the Microsoft .net Framework. It is a technology that provides an abstraction on connectivity technologies to make it easier to implement the message channel pattern when sending data from a client to a service. Typically WCF is associated with Web Services but WCF provides a model for service implementation and consumption which allows you to implement a channel which can use a number of different protocols.
An example of what WCF looks like is shown in the diagram below:
While WCF allows you to create a point to point channel from one application to another it provides an abstraction on the raw transport channel which allows you to use an extensibility model to create your own channels, bindings, behaviours and other extension points. The aim of WCF is to make it simpler to talk to different applications by creating a configurable experience to define the address, transport and messaging semantics which are required between the client and the service.
The main features of WCF are:
- Support for SOAP
- Support for REST
- Support for MSMQ
- Support for custom extensions in many ways
- Support for message security
- Support for transport security
- Support for many WS-* requirements
- Code and Config based experiences
- Custom and IIS hosting of Services
There are many features to WCF and above are some of the main ones.
The key strength of WCF is its extensibility. It is close to a connect to anything type framework. If there isn’t already a binding for what you need then you can create your own and plug it into WCF. Likewise with behaviours to interact with the message you can do similar.
When you consider how extensible WCF is and how many different connectivity scenarios it supports, the fact that in most cases it isn’t that difficult to use is also a strength.
The extensibility benefits of WCF are one of the reasons why technologies such as BizTalk have a WCF adapter which allows the configuration of the same adapter to support so many connectivity requirements.
One of the main weaknesses of WCF is that the growth in support for simpler connectivity models such as REST have made a lot of developers choose a simpler approach which can be achieved without WCF. If your in a new green field world where REST is the way then you can often use WCF to implement and consume services, but there are newer technologies such as Web API which make it easier to implement your services.
There are still many, many other connectivity scenarios where WCF is important and its still going to be one of the first choices for non REST based services.
There aren’t really any dependencies for WCF other than you need the .net Framework and somewhere to host the service if your implementing one.
There is no cost for WCF itself. Its free as part of the .net framework.
The following technologies are similar or have a relationship with WCF:
BizTalk takes advantage of WCF through its WCF adapter which can use the extensibility model of WCF to implement connectivity for many different kinds of applications.
- WCF Routing Service
The WCF Routing Service extends the core WCF framework to implement a routing pattern. The WCF Routing Service uses WCF service and client endpoints to connect services and then in the middle implements a routing table to decide which message goes to which endpoint.
- Web API
Web API is an alternative technology to WCF which can be used to implement REST services. While WCF was the first .net implementation of REST, over time Web API emerged as a simpler approach which was favoured by web developers as it was simpler to implement in line with the RESTful style services. If your doing a new API style project using REST then Web API would be the technology you should look at rather than WCF.