The Baker’s Dozen: A 13-Step Crash Course for Learning Windows Communication Foundation (WCF) This article will present a crash-course in the basics of Windows Communication Foundation (WCF). WCF is one of the exciting new capabilities in the .NET 3.0 Framework. It provides a unified and uniform programming model for building distributed applications. Those who previously built multiple code bases to deal with Web services and .NET remoting will surely come to appreciate the power standardization that WCF offers. WCF, like any other new technology, requires research and experimentation to become productive. This article will assume no prior experience with WCF, and will walk you through some basic exercises and steps to show WCF’s capabilities. What’s on the Baker’s Dozen Menu this Time? In this article I will present a step-by-step guide to building distributed applications with WCF. I’ll minimize the amount of “reading between the lines” that sometimes happens with reference material that makes assumptions about the reader’s knowledge. If you’ve already built even a simple WCF application, you probably won’t find this article to be much more than a refresher-I’m focusing on what someone new to WCF will need for a “crash course”. I’ll walk you through these thirteen steps: - Identify all of the required downloads for developing WCF applications.
- Identify the requirements for a demo distributed application that this article will build using WCF.
- Present an overview of WCF architecture, and how you can use WCF to handle all of the requirements of the demo application.
- Build your first demo-a self-hosted WCF service in which you build the necessary .NET interfaces for the different layers to communicate (part 1 of 3).
- Build the demo .NET server and establish a configuration file to host a WCF service (part 2 of 3).
- Build a .NET client piece to access the WCF service (part 3 of 3).
- Modify the first demo to use more of the WCF object model with code, instead of configuration files.
- The Baker’s Dozen Spotlight: Build a second demo that builds and hosts a WCF service using IIS, in the same way you’d build and host ASMX files (part 1 of 2).
- Host a WCF service using IIS: build the client (part 2 of 2).
- Create a WCF XML Web service and establish configurations for non-.NET clients to consume it (part 1 of 3).
- Register a WCF XML Web service with IIS (part 2 of 3).
- Write code in a non-.NET client to consume the WCF service (part 3 of 3).
- Address some security options with WCF.
See the Recommended Reading section at the end of this article where I list several links to articles that you’ll hopefully feel more comfortable reading after this article. “There Are No Bad Questions…” If you’re new to WCF and distributed computing you may wonder how WCF fits in. | " | Some .NET developers think that you can only use WCF in a Vista environment. In fact, you also can use it with Windows XP Professional. I built and ran all of the sample code using Windows XP Professional.
| " |
Distributed computing is an architecture where the various components of an application reside on different computer systems (often called domains). For example, suppose you load SQL Query Analyzer (or SQL Management Studio) from your desktop, and you open a database on your company’s database server. You type a query or run a stored procedure and you get the results. This is a very basic example of distributed computing. You typed the query from your desktop, but the server performed the work on the server, and fed the results back to you. So each component of the application performed a portion of the overall task. Now think about this from an enterprise standpoint-you want the work and processing to execute on the servers (or domains) that make the most sense. A typical distributed application might feature a client module, a Web server, an application server, and a database server. You may want certain processes to execute on certain domains-perhaps to take advantage of specific hardware, to follow certain development guidelines, or because of restrictions or policies, or maybe other reasons. This article won’t cover how to architect a distributed application. I make the assumption that you’ve already decided where you want processing to occur. Developers often use XML Web services or .NET remoting protocols (or both) so that components of distributed applications can communicate and interact. Prior to WCF, developers usually needed to write and maintain different code bases to deal with each protocol. WCF allows developers to work with these protocols using a unified programming model-eliminating the need for separate code bases. This article will walk through the steps of creating simple WCF applications that use both Web services and remoting. By the end of the article, you’ll see how you can use the WCF programming model to write a single code base to deal with all of the protocol differences. I’m Not Using Windows Vista (Yet) Some .NET developers think that you can only use WCF in a Vista environment. In fact, you also can use it with Windows XP Professional. I built and ran all of the sample code using Windows XP Professional. | & | | 
By: Kevin S Goff Kevin S. Goff, a Microsoft SQL Server MVP, has been writing “The Baker’s Dozen” productivity series in CoDe Magazine since 2004. Kevin hosts a weekly webcast on SQL Server and Business Intelligence topics, at http://www.BDBIRadio.com.
Kevin has been an applications developer, architect, and technology mentor since 1987. Kevin has worked in many lines of business, including insurance, manufacturing, health care, consumer packaged goods, accounting and finance, advertising, and many others. Along the way, Kevin has won several awards in both the public and private sector for applications development. Additionally, Kevin has taught SQL Server, Business Intelligence, and Data Warehousing classes to hundreds of students over a period of five years and has built numerous custom courseware modules along the way.
Kevin has authored one book on reporting development and contributed chapters on MDX programming to a second book. He is currently developing a set of commercial video training courses for SQL Server and BI topics. He has been a SQL Server MVP since 2010 and was previously a .NET/C# MVP from 2005 to 2009.
Kevin is a frequent speaker at User Group and other community events (SQL Saturday, SharePoint Saturday, Code Camp) in the Mid-Atlantic region, and speaks occasionally at conferences. In 2012 Kevin worked with Microsoft TechNet Radio on a 13 week webcast series on new features in SQL Server 2012.
For more information, check out Kevin’s main site at http://www.KevinSGoff.net, or email him at kgoff@kevinsgoff.net
kgoff@commongroundsolutions.net | Fast Facts | | Windows Communication Foundation (WCF) is one of the primary components of the .NET 3.0 Framework. WCF provides a uniform and unified programming model for distributed applications, and eliminates the need for multiple code bases to deal with the differences between communication protocols. | |
|