Thursday, March 26. 2009
WCF Peer-To-Peer (PNRP) under Windows Server 2008
Some days ago on my job I was in charge of extending a legacy .net application to be able to run synchronously on serveral windows server 2008 (standard edition) hosts.
This had to be implemented because of changes to the underlaying host topology (in fact, an standalone webserver was turned into a server farm).
I decided to create a new interface DLL as an adapter to the existing app and use the Microsoft WCF (or "dot-c-f", as they like to call it) API to the PNRP service.
The use of a peer-to-peer architecture made the changes lightweight.
The development of the WCF Interface under windows vista (my development box) went quite well and worked almost immediately.
But the problems came up when I deployed the whole thing to my to win2008 hosts. No peer-to-peer communication was possible, and – even worse – the peers didn't even change their state to "connected" (meaning in microsoft speach that they aren't "alone"), although a connection via TCP and IPv6 was possible between both of the hosts.
This lead my search torwards searching for an infrastructure problem. After googling several results saying that PNRP wasn't possible under win2008 - which I couldn't imagine myself - the solution was finally pretty simple: you just have to install and enable three needed windows services:
1. peer name resolution server (install via server management center as new feature)
2. peer discovery server (same point as above)
3. (not mentioned by MSDN!) the SSDP Service has to be enabled and startet. It is not startet automatically with the PNRP service as there is no service dependency! (Simply change the service start option to Automatically.)
Be sure that all three services are running (and are startet upon system startup) and all your hosts will automagically go into the "connected" state on the LinkLocal-Peer-To-Peer-Cloud.
If you don't know what the SSDP Service is good for: don't mind, I don't either. When you're looking at Wikipedia you will find that SSDP stands for "Simple Service Discovery Protocol" and it is usually used for UPnP Device Discovery. Seems like some creative microsoft programmer decided to use this service in WCF without documenting it!
Finally two more hints, if you're new to WCF P2P Programming:
This had to be implemented because of changes to the underlaying host topology (in fact, an standalone webserver was turned into a server farm).
I decided to create a new interface DLL as an adapter to the existing app and use the Microsoft WCF (or "dot-c-f", as they like to call it) API to the PNRP service.
The use of a peer-to-peer architecture made the changes lightweight.
The development of the WCF Interface under windows vista (my development box) went quite well and worked almost immediately.
But the problems came up when I deployed the whole thing to my to win2008 hosts. No peer-to-peer communication was possible, and – even worse – the peers didn't even change their state to "connected" (meaning in microsoft speach that they aren't "alone"), although a connection via TCP and IPv6 was possible between both of the hosts.
This lead my search torwards searching for an infrastructure problem. After googling several results saying that PNRP wasn't possible under win2008 - which I couldn't imagine myself - the solution was finally pretty simple: you just have to install and enable three needed windows services:
1. peer name resolution server (install via server management center as new feature)
2. peer discovery server (same point as above)
3. (not mentioned by MSDN!) the SSDP Service has to be enabled and startet. It is not startet automatically with the PNRP service as there is no service dependency! (Simply change the service start option to Automatically.)
Be sure that all three services are running (and are startet upon system startup) and all your hosts will automagically go into the "connected" state on the LinkLocal-Peer-To-Peer-Cloud.
If you don't know what the SSDP Service is good for: don't mind, I don't either. When you're looking at Wikipedia you will find that SSDP stands for "Simple Service Discovery Protocol" and it is usually used for UPnP Device Discovery. Seems like some creative microsoft programmer decided to use this service in WCF without documenting it!
Finally two more hints, if you're new to WCF P2P Programming:
- Better turn off the windows firewall, as it is blocking the IPv4 to V6 Teredo tunneling driver. Be sure that IPv6 is supported by your network infrastructure, as it is mandatory for the PNRP protocol.
- Don't forget a config flag in your app to disable the p2p functions, as there will always be a collegue that is wondering where the heck these "random" informations came from (if he's not aware of other peers running in the same cloud, doing some crazy buggy stuff).


/* Comments */