Tuesday, August 18, 2009

Troubleshooting WCF on Windows Server 2008

Recently I had to check some webparts which are using WCF services and which were deployed on Windows Server 2008. The only thing to check was this nice cryptic error message:

TCP error code 10061: No connection could be made because the target machine actively refused it

I finally got this working … but still the troubleshooting steps might be interesting:

  • First thing to notice – the WCF service installed under port 32845 and when I looked at the bindings in IIS it was using net.tcp.
  • Check if the necessary Windows Server 2008 features are installed using the Server Manager:
    • WCF activation
      • HTTP activation
      • Non-http activation
  • Next check – the IIS 7.0 website hosting the WCF services – if you look at the UI – you will notice this strange “?” icon on top of the site. Unfortunately this does not mean that there is something wrong with the site hosting– in this case it just points to the fact that you have multiple bindings for different protocols.

    If you look at the status screen (Click on sites) you will probably see “Unknown” for the net.tcp protocol. This is not a problem – just check that the web site is started.

  • Right click the website which is hosting the WCF services and select Manage website> Advanced settings and check if tcp is an enabled protocol.

    For some info about how to do this in Vista check out see How to: Install and Configure WCF Activation Components - On Windows Server 2008 you can everything through the UI – so you don’t need the command line scripts – as outlined before
  • Take a look at  Checklist: Use TCP Port Sharing to Allow Multiple WCF Applications to Use the Same TCP Port
  • Check the firewall settings on Windows Server 2008 – Go to Server Manager > Configuration, here you will see Windows Firewall with advanced properties. Make sure that you have the correct and inbound rules… (or disable them just to troubleshoot)
  • Make sure that the Net.TCP listener adapter and Net.TCP Port Sharing Services are running (Server Manager > Server Roles > Application Manager)

    As a matter of fact, it was this last setting in combination with the firewall settings which caused my WCF services to fail

Related reading:

1 comment:

Steven Spits said...

I have a self-hosted service in a console application for troubleshooting stuff like this. If it works, you're facing an IIS related problem. If it doesn't, you need to check your settings in Windows. Also, Microsoft Network Monitor is an excellent tool to see if you run into firewall issues.