Windows Communication Foundation (WCF) – First steps

This article introduces a very small Visual Studio .NET 2008, .NET Framework 3.5 SP1 Solution that reflects my experiences after some days of diving into Windows Communication Foundation (WCF).

Since we see the need to make some of our applications (including this one and that one) more “distributed environment aware”, I wanted to do some research in the basic WCF areas.

My goal was to design a system where I’m still able to compile a WCF aware application into a stand-alone version that completely operates without any server. I developed some small tests applications which you can download as source files and binaries.

Test applications

The following test client applications exist:

  • A Windows Forms client application.
  • A Web Forms client application.

The available server test applications are:

  • A Web application that hosts the WCF service.
  • A Console application that hosts the WCF service.

The WCF service itself is modelled inside a single .NET DLL (assembly).

Hosting

Since I wanted to test multiple scenarios, I managed to implement the following:

  1. Calling a service that is running inside a Web application from a Windows Forms client.
  2. Calling a service that is running inside a Console application from a Windows Forms client.
  3. Self-calling a service that is running inside a Windows Forms application from within the same Windows Forms application.
  4. Self-calling service methods that are compiled into a Windows Forms application from within the same Windows Forms application.

The last two parts differ in a way that option 3 actually uses WCF to communicate with itself, whereas option 4 really just references the assembly (DLL) that contains the services and creates an instance of the service class with the new operator.

So I will try to use option 4 for compiling stand-alone versions of applications that need no WCF functions but still can be built from the same code base.

Download

The following download examples are available:

Summary

Although I am just starting to touch the basics of WCF, I like what I have seen so far. :-) Much better than the .NET Remoting stuff I tried several years ago.

The biggest amount of work probably will go into (re-)designing the application architecture to fit the WCF needs of a distributed system.

Looking forward for your comments!

Leave a comment