Windows Communication Foundation (WCF)
  • 07 Sep 2020
  • 4 Minutes to read
  • Contributors
  • Comment
  • Dark
    Light
  • PDF

Windows Communication Foundation (WCF)

  • Comment
  • Dark
    Light
  • PDF

Article Summary

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:

image.png

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.

Features

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.

Strengths

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.

Weaknesses

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.

Dependencies

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.

Costs

There is no cost for WCF itself. Its free as part of the .net framework.

Similar or Overlapping Technologies

The following technologies are similar or have a relationship with WCF:

BizTalk

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.

While WCF is still common to come across in many organisations we would recommend that you take a preference towards building API architectures with technologies like Web API and REST based API's for anything new.

With the above in mind however we expect that for a good while to come you will find that there are scenarios for application integration or vendor integration where there will be some existing soap services which will require you to use WCF. There are also some line of business application connectivity features offered with the WCF stack which you may also be using.

I would also say at this stage WCF is tied to the lifecycle of .net Framework. In the short and medium term you are fine, but keep an eye on .net Core. As .net core does not plan to support WCF and as .net Core

Recommendation

Microsoft has chosen to move WCF to be a community supported project rather than include it in the out of the box .net core frameworks (https://github.com/CoreWCF/CoreWCF). Based on this lack of commitment to WCF it is not something I would look to invest in for new projects and people are more likely to be using REST with Web API for new things these days.

I believe with existing implementations you should be looking to move away from WCF if possible as part of your .net core migrations


Was this article helpful?