473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Best way to communicate between Windows Service and GUI?

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
ca*****@tamu.edu
Nov 16 '05 #1
4 35439
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" <ca*****@tamu.edu> wrote in message
news:u1***************@TK2MSFTNGP11.phx.gbl...
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
ca*****@tamu.edu

Nov 16 '05 #2
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" <ca*****@tamu.edu> wrote in message
news:u1***************@TK2MSFTNGP11.phx.gbl...
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
ca*****@tamu.edu

Nov 16 '05 #3
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
ca*****@tamu.edu
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
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" <ca*****@tamu.edu> wrote in message
news:u1***************@TK2MSFTNGP11.phx.gbl...
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
ca*****@tamu.edu


Nov 16 '05 #4
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" <ca*****@tamu.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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
ca*****@tamu.edu
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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" <ca*****@tamu.edu> wrote in message
news:u1***************@TK2MSFTNGP11.phx.gbl...
> 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
> ca*****@tamu.edu
>
>



Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Russ McDaniel | last post by:
Originally posted to microsoft.public.dotnet.distributed_apps with no response. Reposted here with additional thoughts. --- Hello, I'm writing a Windows service which performs some...
7
by: Lalit | last post by:
Hi Friends, I have developed a Windows service. Now i need icon for this service in systray and context menu fo this icon. Can i do this? With regards, Lalit
2
by: Andrew Mueller | last post by:
Hello all, I have created a windows service and now I would like to have a configuration page in the system tray. Basically an icon I can click on which will just interact with an XML file. ...
5
by: Girish | last post by:
Im looking for information on how to build a windows service (not web service) on a .net enabled platform. Now, ive had some experience building services using vc++ 6.0 - and I can tell you its...
2
by: J | last post by:
Hello, What is the best/easiest way to setup interprocess communication between a windows service and a webservice? The windows service will be running on the same machine that is hosting the...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
1
by: methodios | last post by:
Is there a way to create a windows service that can communicate with an ASP.NET page running IIS via HTTP protocol as the communicate medium? The service will act as a listener on whatever port and...
2
by: Jenbo | last post by:
Hi all, I have a task at the minute which involves getting data from csv files into a database and doing some nice auditing on the records in there on a web front end. The csv files are going to be...
3
by: Diego L Espiñeira | last post by:
Hi, all I've got a windows service (server) application and a winforms (client) application. What I need to do is to host a web service in the windows service application so the client can request...
3
by: =?Utf-8?B?bGVvMg==?= | last post by:
Hi All, I have a question which might be a beginner's question. I have a webservice whose webmethod has to call a window's service and get back the results. What is the best way to implement...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.