Windows Communication Foundation (WCF) is Microsoft's contribution toward developing a framework for building platform-independent, protocol-independent services. Released as part of Microsoft .NET Framework 3.0, it has quickly become the technology of choice for .NET developers for designing and implementing scalable services. WCF 4.0 provides many new interesting new features and enhancements. This article highlights the most useful of these new features and enhancements and illustrates them with code snippets wherever applicable.
What Is WCF?
WCF is a framework designed by Microsoft that's based on service-oriented architecture (SOA). It can be used to design SOA applications that can have the capability to inter-communicate. WCF was initially code-named "Indigo" and was made available as part of .NET Framework 3.0 in 2006. (See the WCF information on MSDN for more information.)
New Features and Enhancements in WCF 4.0
The main new features and enhancements in WCF 4 fall into these areas:
- support for simplified configuration
- support for routing service
- support for simplified IIS hosting
- support for REST-based services
Simplified Configuration
WCF 4.0 provides support for a simpler configuration. You no longer need to specify the tedious configuration details of the earlier versions of WCF for hosting your WCF 4.0 service now. Consider the following simple WCF service, shown in Figure 1.
Figure 2 shows all you need to write now in WCF 4.0 to host your WCF service. And Figure 3 shows what you can specify to consume your WCF service.
If you would prefer a more secure binding, like "wsHttpBinding", you can instead use the configuration that Figure 4 shows.