Wednesday, August 25, 2010

WCF and Parallels Desktop

A couple of days ago I was experimenting with Windows Communication Foundation (WCF).  This consisted of creating small server/client applications to explore the capabilities of WCF.

While experimenting with WCF 'Discovery' (the server can broadcast that it's available or the clients can probe for a service), I found that my code worked when both the client and server ran on the same machine, but I could not get it to work when the server ran on one machine and the client ran on another machine.

The server ran an on old Dell desktop (Windows XP), while the client was running on a virtual machine (Parallels Desktop/Windows 7) on a MacBook Pro.

One interesting thing about WCF Discovery is that in ad-hoc mode (the one I was using) it only works on the local sub-net.  My home network is setup to use 192.168.1.xxx, so in theory everything should have been Ok.  After about 5 hours hours of frustration and not being able to understand why it was not working I looked at the IP addresses the machines were using, the Dell was using 192.168.1.4, the MacBook Pro was using 192.168.1.5 while the virtual machine was using the 10.x.x.x private IP address space, so effectively the Dell and the virtual machine were running on different subnets - hence the problem.

It looks like the installation of Parallels Desktop created it's own NAT/DCHP server, changing the Parallels Network setting to 'Airport' and rebooting the virtual machine resulted in an IP Address of 192.168.1.25 and this solved the problem.