GUI and windows service communication

24,344

Solution 1

If you are going to be developing with .NET, use WCF for your interprocess communication. WCF greatly simplifies development because the intricacies associated with a specific communication mechanism (e.g., sockets, pipes, etc.) are abstracted behind a unified programming model. Thus, it doesn't matter if you choose to use http, tcp, or named pipes for your transport mechanism, the programming model is the same.

I would highly recommend Juval Lowy's book Programming WCF Services for all things WCF. You can also visit his website, IDesign.net, for free WCF code samples.

For an overview of WCF, watch this free video at dnrTV. It covers the purpose of WCF and demonstrates WCF programming through some easy-to-follow examples.

If you have not already created your Windows service but plan to do so in C#, you can follow the step-by-step here.

Solution 2

There are many ways to communicate between processes - named pipes, mailslots, memory mapped files, sockets, ActiveX/COM objects, just to name a few. It really boils down to which technologies you are familiar/comfortable with.

Share:
24,344
Stéphane
Author by

Stéphane

Updated on November 21, 2020

Comments

  • Stéphane
    Stéphane over 3 years

    I know since Vista, that C# can't hook a UI form directly to the windows service. This was stated on the Microsoft Site.

    My question in this regard is: "What is the best mode of communication from a UI to the service?"

    I have heard of Remoting, Web services, and direct TCP. Are there other methods? How do they rank against the previously mentioned methods? How complicated are they to implement?

    My application is for intranet use, not internet. Microsoft platform will be on both sides, so interoperability is not a factor, but speed is. I mean I want to get across the smallest packet possible on the network.

    TIA