Multimobile Development: Building Applications for any Smartphone
Best way to communicate between Windows Service and GUI?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.csharp.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Adam Clauss
I am currently developing an application which will primarily run as a service that starts with Windows. However, I want to also
have an 'administration' tool that can be run that controls various aspects of the service (not simply start/stop). What methods
exist to communicate between these two separate processes? And pros/cons of them?

Thanks!

--
Adam Clauss
Click here to reveal e-mail address

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
J.Marsch
One of the most straightforward methods that I can think of would be to use
remoting. Remoting lets you appear to instance an object in your client
code that is really running in the server process (kind of like DCOM).

A pro would be that you would actually be able to install the admin tool on
separate workstations if you wanted to. One con that I can think of off the
top of my head: using the built-in remoting channels, the server would be
required to have TCP/IP, even if both the service and the admin tool were
running on the same box -- that's because the remoting channels that come
with the framework route their messages through TCP/IP.

"Adam Clauss" <Click here to reveal e-mail address> wrote in message
news:u1K%Click here to reveal e-mail address...
> I am currently developing an application which will primarily run as a
service that starts with Windows. However, I want to also
> have an 'administration' tool that can be run that controls various
aspects of the service (not simply start/stop). What methods
> exist to communicate between these two separate processes? And pros/cons
of them?
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
    
Jay B. Harlow [MVP - Outlook] (VIP)
Adam,
In addition to Remoting you can use ServiceBase.OnCustomCommand to send
simply Integer commands to your Service. Allowed values are 128 to 256.

You would use ServiceController.ExecuteCommand to execute the individual
commands.

Of course anything with any substance I would use .NET Remoting as J.Marsch
suggested.

In the Service Manager/Administrator that I am working on I currently intend
on use Custom Commands where I pass an Enum, as all the commands will be
super simple...

Hope this helps
Jay

"Adam Clauss" <Click here to reveal e-mail address> wrote in message
news:u1K%Click here to reveal e-mail address...
> I am currently developing an application which will primarily run as a
service that starts with Windows. However, I want to also
> have an 'administration' tool that can be run that controls various
aspects of the service (not simply start/stop). What methods
> exist to communicate between these two separate processes? And pros/cons
of them?
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Adam Clauss
Thanks to both of you for your suggestions. My commands I will be issuing will be more complex than simple integers, so I will look
into the Remoting method.

--
Adam Clauss
Click here to reveal e-mail address
"Jay B. Harlow [MVP - Outlook]" <Click here to reveal e-mail address> wrote in message news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First chapters of Multimobile Development book now available on Apress Alpha program
iPad
 
    
Willy Denoyette [MVP] (VIP)
Another option is to expose object instances through System.Management and
WMI in your service, the client application(s) can query these instances. To
pass commands to the service you could install a Management event handler
and let the client fire events passing objects as command arguments.
The advantage over remoting is that it uses DCOM as wire level protocol with
it's built-in security.

Willy.

"Adam Clauss" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
 
System.ServiceProcess.ServiceBase
System.ServiceProcess.ServiceController




Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734