o far, this Windows Communication Foundation (WCF, formerly known as Indigo) series has provided a primer
, and discussed security
. The final pillar in the tripod that supports software-as-a-service is reliability, with which you can achieve the secure, transactable, and reliable services that WCF promises.
But what is reliability, and why is it so important? First, reliability is a key differentiating factor between software systems that cost millions of dollars to develop or own, and those that don't. Consider a financial scenario for portfolio management as an example. You have a number of assets at a brokerage; say 100 shares of Stock A and 10 shares of Stock B. You think stock B is likely to do well, but don't have enough funds to buy it. So you issue a command to sell your 100 shares of stock A, estimating that with the proceeds you will easily be able to afford 10 shares of stock B. But rather than wait for the transaction to complete, you also issue a command to buy 10 shares of stock B. Deals don't need to be realized for 3 days after the trade, so by the time you get the money for selling stock A you can afford stock B.
But what if the brokerage system was unreliable, and your command to sell 100 shares of stock A was never receivedand you didn't bother to check for a confirmation? For example, what if you issued the trade via a cell phone and then hung up? And then suppose stock A crashed the next day. You'd be up the proverbial creek, because you'd still need to pay for stock B within 3 days, and the funds to do so are no longer there.
This would clearly be an intolerable situation, and no brokerage that did this on a regular basis would stay in business for long. So how do you fix it?
You could grow a system that has in-built checking of messages and offers a communication protocol between the client and the trading system that ensures everything is checked, counter checked, confirmed, and updated. But then you'd be in the same boat as everyone elseforced to develop a large-scale system expensive to develop, maintain, and run.
Alternatively, you could start by looking at standards. When it comes to SOA, the standard for reliability is WS-Reliability; and fortunately, reliability has never been easier to implement than by using WCF.
Setting up a Windows Communication Foundation Development System
|Author's Note: The previous articles in this series were based on the beta of Visual Studio.NET 2005 and the September preview of WCF. Since then, VS.NET 2005 has been officially released, and a new preview version of WinFX/WCF, called simply "the December CTP," is now availableand it's much easier to install and use. I've used this version to develop the code in this article.
Microsoft has provided a convenient download page
that gives you links to all the necessary downloads.
|Figure 1. New WinFX Service: The figure shows the dialog you'll use to create a new WinFX Service using Visual Studio.NET.|
From that page, you'll need to download and install the following:
- WinFX RTC (run-time components)
- The Windows SDK
- The Visual Studio.NET extensions for WinFX
|IMPORTANT: Install the items in the sequence shown above to make sure that everything works. Also, note that the WinFX extensions balk if you do not have the MSDN documentation installed with your development environment, so if you don't have the documentation installed, install it before you install the WinFX beta. Finally, make sure that you launch the development environment and start up the help system, configuring it for "local access" before you install them.
After you've followed the instructions above and downloaded and installed WinFX, you can verify that the installation works by launching Visual Studio.NET and issuing a File->New Website command. The New Web Site dialog will appear. The first option will be to create a "New WinFX Service" (see Figure 1
). Go ahead and select that option. That sets up everything for you and you'll be ready to build a WCF service.