Configuring WCF application on Windows 7

Creating a web service in Visual Studio has been possible since the inception of .NET framework. It was a trivial task in Visual Studio provided IIS was already installed on the machine.  Configuring IIS required a minimal effort on the part of the user.
The version 3.0 of .NET framework introduced several new features. Windows Communication Foundation also known as WCF was just one among many. It is a successor to web services and requires at least Visual Studio 2005. Configuring WCF on IIS 7.0 and Windows 7 is definitely not a trivial task.

The first step to configuring Windows 7 machine to host a WCF application is making sure IIS 7.0 has been installed and configured properly. The default configuration does not suffice. WCF requires ASP.NET to be installed and virtual directory to be created for the WCF application.

This creates Classic .NET AppPool under application pools in IIS.

The properties of the application pool need to be configured in the following way:

At this point, the IIS has been configured to host a WCF application. We can create a virtual directory that points to our compiled WCF application. If we try to test the WCF application we will receive an error “Unrecognized attribute ‘targetFramework’. Note that attribute names are case-sensitive.”

It is telling us that our application is trying to use incorrect version of the .NET framework. We need to modify “Basic settings” for the virtual directory of our WCF application.

Under the “Basic Settings” option we need to select Classic .NET AppPool which is configured to use version 4.0 of .NET framework.

Testing our application may still fail. We may be still missing a windows feature “Windows communication foundation HTTP activation.

If our application still fails to work, make sure that the folder security permissions have been given to user IIS_IUSRS

We have almost finished configuring our machine and the WCF application. Everything should be working fine. Modifying all these settings and features may have damaged ASP.NET settings that would cause “HTTP Errror 500.21”.

We need to open the command prompt in .NET framework 4.0 folder or from Visual Studio and run “asp_regiis –i”

We can test our WCF application from the browser using the address such as http://localhost/WcfService1/Service1.svc. The output should look similar to this one:

Configuring a Windows 7 machine and a virtual directory for WCF in IIS 7.0 has become more complex than it was for a web service in the previous versions of Windows and IIS 6.0. I find it disappointing that Microsoft made is harder, instead of easier to create a WCF application.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.