Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

The Baker's Dozen: A 13-Step Crash Course for Learning Windows Communication Foundation (WCF)

WCF is meant to make things easier for developers, but as with any new technology, getting started can be difficult. Follow these thirteen steps to rev up your WCF knowledge quickly.


advertisement
CF 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 of standardization that WCF offers. WCF, like any other new technology, requires research and experimentation to become productive. This article presents a crash course in the basics of Windows Communication Foundation (WCF). It assumes no prior experience with WCF, and walks you through some basic exercises and steps to show WCF's capabilities.

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. The Current Baker's Dozen Menu
You'll see 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 ever built even a simple WCF application, you probably won't find the content here to be much more than a refresher—it focuses on what someone new to WCF will need for a "crash course." I'll walk you through these thirteen steps:

  1. Identify all the required downloads for developing WCF applications.
  2. Identify the requirements for a demo distributed application that this article will build using WCF.
  3. Present an overview of WCF architecture, and how you can use WCF to handle all the requirements of the demo application.
  4. 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).
  5. Build the demo .NET server and establish a configuration file to host a WCF service (part 2 of 3).
  6. Build a .NET client piece to access the WCF service (part 3 of 3).
  7. Modify the first demo to use more of the WCF object model with code, instead of configuration files.
The Baker's Dozen Spotlight:
  1. 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).
  2. Host a WCF service using IIS: build the client (part 2 of 2).
  3. Create a WCF XML Web service and establish configurations for non-.NET clients to consume it (part 1 of 3).
  4. Register a WCF XML Web service with IIS (part 2 of 3).
  5. Write code in a non-.NET client to consume the WCF service (part 3 of 3).
  6. 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 feel more comfortable reading after absorbing this material.


There Are No Bad Questions…
If you're new to WCF and distributed computing you may wonder how WCF fits in.

Author's Note: Some .NET developers think that you can use WCF only in a Vista environment, but that's not true—you also can use it with Windows XP Professional. I built and ran all 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 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. I 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. You'll walk through the steps to create 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 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 the sample code using Windows XP Professional. "I've Seen All Good People…"
I want to thank Sam Gentile, Ted Neward, Rick Strahl, and Thom Robbins for helping me with WCF questions that I had while researching this article. In many ways, the steps in this article reflect the learning curve I recently experienced.

Editor's Note: This article was first published in the May/June 2007 issue of CoDe Magazine, and is reprinted here by permission.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap