As we have learned from previous chapters, WCF provides a unified programming model for building service-oriented applications. With WCF, you can build secure, reliable, transacted solutions that integrate well across different platforms and interoperate with existing investments. The WCF programming model is very comprehensive, yet it is also very flexible. You can extend this model to enhance the functionality or customize the framework for your specific needs. In the last chapter of this book, we will explore extension points of WCF services and learn how to extend a WCF service.
We will cover the following topics in this chapter:
HelloWorldService
The WCF runtime provides a set of classes responsible for sending and receiving messages. For example, formatting messages, applying security, transmitting and receiving messages by using various transport protocols, as well as dispatching received messages to the appropriate operations, all fall within the WCF runtime scope.
The following diagram shows WCF runtime (http://msdn.microsoft.com/en-us/magazine/cc163302.aspx):
The sequence of a WCF service call might look as follows:
As you can
see from this diagram, there are multiple layers and many entry points for a WCF service call. At almost every entry point, there is a possible extension interface that you, as a WCF developer, can extend. In fact, there are over 30 extension points in the WCF runtime. In this chapter, we will explore some common extension points and we will extend our HelloWorldService
to log incoming/outgoing messages.
For a comprehensive list of WCF extension points, look at the MSDN documentation on WCF extensions. Additionally, you might want to check out the blog at http://blogs.msdn.com/b/carlosfigueira/archive/2011/03/14/wcf-extensibility.aspx for WCF extension points. (This blog explains many of the WCF extension points up to .NET Framework 4.0, but they are all valid for .NET 4.5.)