Search code examples
wcfwindows-services.net-3.5named-pipes.net-remoting

IPC methods for Windows Service


I currently have a Windows service and a separate GUI client targeting .NET 3.5 and am trying to find the best way to get a bidirectional communication between these two processes. Both processes will run on the same Windows machine.

The Microsoft Interprocess Communications page seems to suggest using RPC, Pipes or Sockets for this particular case scenario.

I decided that Named Pipes seem to satisfy my requirements but looking around I have also encountered .NET Remoting . It seems that .NET Remoting was integrated into WCF as from .NET 3.0. From what I understand, WCF uses 'named pipes' to communication between processes so I am guessing that .NET remoting and 'named pipes' somehow overlap.

Can somebody clear this out please? I'd like to understand whether I should be using Named Pipes, .NET Remoting or WCF.


Solution

  • WCF replaced both .NET Remoting and the older (now legacy) ASMX web services. The WCF NetNamedPipe binding is duplex (i.e., supports bi-directional communication), and since both the client (the GUI application) and the Windows Service are on the same machine, named pipes is ideal.

    However, to utilize WCF you'll have to write the WCF service, and use the Windows Service to host it, with the GUI app acting as the client. This is entirely possible to do, and there are many examples on the web of how to host a WCF service in a Windows Service.