Tuesday, February 16, 2010

WCF Activation in Windows 7 and Windows 2008

Background

In my earlier post on Windows 7 I had mentioned about the performance of Windows 7 being faster compared to earlier Windows operating systems. I had also mentioned about the minimal effort required for the installation of Windows 7 operating system. My team has been developing few Windows Communication Foundation (WCF) services. Our target environment is Windows 2008 server. For some reason we were unable to browse the WCF services on our deployment environment but they were working fine on our development environment which is Windows XP.

By default WCF Activation is disabled in Windows 7 & Windows 2008 server

We use Windows Installer Scripts (WIX) for generating the MSI installation packages. There is a dedicated team which provides us the testing and deployment environments. We were provided a Windows 2008 server machine with IIS configured on it. We installed the MSIs for the services on the server. These services are accessed by a WPF client. We could not access the services from the WPF client.

After doing initial checks about the endpoint and URL checks in the configuration file we tried accessing the .svc file using the browser on the server. We were unable to browse the file. We tried running the aspnet_regiis again to establish the mappings. But that also did not help.

We checked the mapping for .svc extension in the IIS MIME types. That was an indication that for some reason .svc extension was not mapped in IIS. We added the mapping manually and assigned the ISAPI.dll as the executable. After this the service started working.

It so happens that by default many of the services like IIS, MSMQ etc are not enabled by default with the operating system. We need to explicitly enable them. This can be seen from screenshot below

WCF Activation

Enable WCF Activation on Windows 7 & 2008 server

In order to enable the correct script mapping to .svc check the Microsoft.NET Framework 3.5.1 option in the Turn on Windows Features on or off dialog box. Select both Windows Communication Foundation HTTP Activation and Windows Communication Foundation non-HTTP Activation options as shown below

Enable WCF Activation

This will install the required script maps and handler mappings. You can check the handler mappings under the default web site in IIS.

svc handler mappings

Conclusion

The performance of Windows 7 and Windows 2008 is relatively better as compared to previous operating systems because not all services are installed by default. This also speeds up the installation process as only basic features are installed. users need to explicitly enable the services required by them. Unlike earlier operating systems you need not restart the system for the settings to take effect.

Hope this helps. Until next time happy programming :)

Further Reading

Following are some books I recommend related to the topics discussed in this blog.

7 comments:

  1. Anonymous9:09 AM

    Beautiful!

    ReplyDelete
  2. Windows 7.. i need it!

    Love if you'd add your blog to my site. It might get you more exposure (as well as increase your Google ranking!)

    ReplyDelete
  3. What about win XP

    ReplyDelete
    Replies
    1. Sonia,
      I haven't tried running this on XP as I don't have an XP machine. But I found following link which might be helpful to you
      http://forums.silverlight.net/t/155483.aspx/1

      Delete
  4. Can you please explain WCF Activation in Win Server 2003

    ReplyDelete
  5. Anonymous1:07 AM

    thank you!.

    ReplyDelete