WCF 101: Introduction to Windows Communication Foundation

August 27th, 2006 Comments

Windows Communication Foundation (WCF) is Microsoft’s next generation platform for distributed systems. Along with Windows Presentation Foundation (WPF) and Windows Workflow Foundation (WWF), WCF (code-named “Indigo”) is part of the WinFX platform, now officially named as .NET Framework 3.0.

With such a diverse array of distributed technologies already floating around, each one with a distinct benefit, Microsoft decided to unify these technologies under a single unified platform that would not only simply developers’ lives but also pull in the benefits of all such existing technologies into one.

ASP.NET web services, for example, offer ease of programability, WSE offers security, System.Messaging offers guaranteed delivery of asynchronous messages, Enterprise Services offers attribute based transaction support, and yet .NET Remoting offers transparent use of objects. WCF unifies all these benefits and more such that the code base remains the same, while depending upon the requirements, features such as transactions can be configured mostly through XML configuration settings.

WCF is based on Microsoft’s vision of Service Oriented Architecture (SOA), where developers shall be able to combine multiple services (could be cross-platform and cross-vendor) to invent software applications that have not yet been possible.

WCF is based on a well-thought-out design where services and clients define one or more end-points. Each end-point defines the address, binding, and contract (ABC) which can be configured independently, but work together to provide a distributed message-oriented communication infrastructure.

WCF runs on Windows Vista, XP and 2003. Beta versions of .NET Framework 3.0 (including WCF) can be downloaded from Microsoft.

Inherit With Care

July 18th, 2006 Comments

I was asked to look at an ASP.NET 1.1 application that was designed with a distributed architecture using .NET Remoting. Over a period of a few hours of heavy usage, this production application would intermittently bring the Windows 2003 Server that it was being hosted on to a screeching halt. Cause unknown. No event log entries, nothing suspicious in IIS logs, nothing too special about the application that would indicate this behavior. Performance monitoring, however, indicated that the handles on the OS would gradually increase to dangerous levels of 50,000+ before the application would crash. Hmmm, what could be using so many handles and not releasing them? My first instinct was to make sure that all the remoting objects were disposed properly after use. Upon closer investigation, however, I found out that all ASP.NET pages in the application were inheriting from a custom base class. The base class was overriding the page’s Init method, and guess what I found in that method? A call to RemotingConfiguration.Configure() method. At first I was surprised why would someone configure remoting every single time a page is instantiated? Soon it hit me why system handles were astronomically increasing. Once that line of code was moved to Application_Start event, the application hasn’t crashed in weeks. Moral of the story? Inheritance is a good OO concept, but only we as developers can decide how badly we want to abuse it!