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
Windows services cannot have GUIs, so you will need to either get rid of the GUI or separate your application into two pieces - a service with no UI, and a "controller" application.
Right-click the service name, and select Properties. The Service Properties window is displayed. Select the Log On tab. Select Local System account and then select Allow service to interact with desktop.
The service communicates with the GUI application to tell it when to display the GUI. The application communicates the results of the user interaction back to the service so that the service can take the appropriate action.
Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With