Learning WCF

This easy-to-use introduction to Microsoft Windows Communication Foundation (WCF) is ideal for developers who want to learn to build services on a company network or as part of an enterprise system. Built into Windows Vista and Longhorn, and available for Windows XP/SP2 and Windows 2003, WCF provides a platform for service-oriented architecture (SOA) that enables secure and reliable communication among systems within an organization or across the Internet. With WCF, software developers can focus on their business applications and not the plumbing required to connect them. Furthermore, with WCF developers can learn a single programming API to achieve results previously provided by ASMX, Enterprise Services and .NET Remoting. This book removes the complexity of using this platform by providing detailed answers, explanations and code samples for the most common questions asked by software developers.

This book is lab-based, with loads of samples illustrating practical use of WCF features. I think that any developer that is new to WCF will find this useful for getting started. You will also find that while I introduce things slowly for the beginner, I also lead you through more advanced scenarios and recommended practices. You be the judge, and let me know what you think!

Visual Basic Plans:
I wrote this book using C# but we will be making VB samples available on this site at the time of publication which is May 2007. I also encourage you to email me with questions related to the book labs and samples in VB, if you are having difficulty - so that I can blog those questions and answers here along with other book discussions.


Here’s a brief look at what you’ll take away from each chapter.

Chapter 1: Hello Indigo

Having started working with the platform very early on I became quite attached to the code name for WCF, Indigo. Alas, we all have to give up code names for product names, eventually…but that doesn’t stop me from paying homage to it in Chapter 1. In this chapter you will be introduced to WCF, the problems it solved for distributed enterprise systems, and learn how it supports Service Oriented Architecture. In addition, you’ll learn many fundamental concepts that will make you immediately productive with WCF including creating service contracts and services, hosting services, and generating proxies to invoke services.

Chapter 2: Contracts

This chapter focuses on contracts and serialization. It teaches you how to design service contracts, how to create data contracts for complex type serialization, and how to work with other serializable types to solve specific challenges including contract-first design approaches. You’ll learn how services expose metadata to clients for proxy generation, and how metadata exchange supports this. In addition, the chapter provides you with guidance for versioning service contracts and data contracts.

Chapter 3: Bindings

Bindings are the heart of WCF. Through bindings, you configure the communication protocols supported by services, including those related to interoperable messaging. This chapter explains practical uses for each of the core bindings, how to customize those binding configurations for intranet and Internet applications, for one-way messages and callbacks, and for handling large message payloads. You’ll also learn how bindings configure communication channels for clients and services, and learn how and when to apply custom bindings to handle special situations.

Chapter 4: Hosting

This chapter explores the various hosting options for WCF services including Windows applications, Windows services, IIS and the Windows Activation Service. You’ll learn about the hosting features and protocols supported by each environment, about the underlying hosting architecture they share in common, and practical reasons for selecting each hosting environment.

Chapter 5: Instancing and Concurrency

Instancing and concurrency modes control the allocation of services to support requests, and have a real impact on application scalability. This chapter covers how to configure services to run as singletons, to provide support for application sessions and concerns they introduce, or to run as scalable session-less services. Concurrency modes that impact the number of concurrent requests, and other service throttling behaviors are also discussed. You’ll learn the scalability implications of each option and take away recommendations related to load balancing services.

Chapter 6: Reliability

WCF features such as reliable sessions, distributed transactions, and queued messaging improve the overall reliability of an enterprise system. Reliable sessions, based on interoperable protocols, make it possible to overcome transient network interruptions; transaction support over TCP and HTTP improve system consistency; and queued messages provide durable and transacted reliability. This chapter explores how you apply these features with WCF, with guidance on when to use each feature.

Chapter 7: Security

This chapter covers a lot of ground since security features run deep in WCF. I first describe the fundamental security concepts as they are implemented by WCF, including identities, mutual authentication, and message protection as it is implemented for key WCF bindings. Then, in an attempt to simplify this otherwise daunting subject, I provide you with scenarios for intranet, Internet, partner or machine authentication with certificates, and federated security. I provide you with guidance on how you would configure these scenarios, while reducing the noise of features that don’t apply to it. What you should take away from this chapter is an understanding of several rich security scenarios with samples that can serve as starting templates for your applications.

Chapter 8: Exceptions and Faults

Although I do talk about exceptions and faults in appropriate places earlier in the book, this chapter focuses solely on error handling concepts including debugging techniques, fault contract design, and error handling components. I put this chapter last because you will have more context from earlier chapters related to the types of things that can go wrong, and because I cover some advanced extensibility features of WCF.

Appendix A

This appendix provides detailed setup instructions for database configuration and setup, for ASP.NET membership provider model setup, and for working with certificates. You will be directed to this chapter periodically for support in setting up labs and code samples.

Appendix B

This appendix includes an article that I wrote for ASP.NET Pro on Windows CardSpace to provide additional background on the technology that is explored briefly in Chapter 7.

Designed by NUKEATION STUDIOS