How to raise an event from my windows application to my windows service?

  • Thread starter Thread starter Filipe Marcelino
  • Start date Start date
F

Filipe Marcelino

Hi,

I'm an experienced vb .net developer in windows forma. Now I'm trying
to develop a windows service and I would like to know if it's possible
to raise an event from a windows application developed by me to a
windows service developed by me. I would like to do something like,
when a user changes something inmy application I would like to fire an
event to my windows service and make a log. Is this possible?

If I'm not clear please make me know.

Regards,
Filipe Marcelino
 
There are a couple of ways to tackle this.

1. Create a windows service that has a listener and leave it running
2. Create a web service, either through ASMX (bound to a "web app") or
Remoting

In the second instance, the guts of the listener are already configured for
you, esp. in the case of the ASMX service. To fire off to this type of
service, you send a message through a TCP socket.

If you go this route, Remoting will perform better as it is not tied to the
HTTP stack. There are also plenty of examples in remoting, showing how to set
up both "server" (the listening service) and "client" (your application).

If you go the other route, you will have to configure the plumbing yourself,
although the Remoting samples, along with a peak at the Remoting core (with
ILDASM or, preferably, Lutz Roeder's Reflector with teh File Dissassembler
plug in), will help you.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Use remoting. Have the sevice expose a remoting endpoint (wellknown singleton maybe) and connect to it from the windows application. The application can then notify the service when "interesting" things happen. If you are using .NET 2.0 you can use the IPC channel which saves you opening a port on the machine.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

I'm an experienced vb .net developer in windows forma. Now I'm trying
to develop a windows service and I would like to know if it's possible
to raise an event from a windows application developed by me to a
windows service developed by me. I would like to do something like,
when a user changes something inmy application I would like to fire an
event to my windows service and make a log. Is this possible?

If I'm not clear please make me know.

Regards,
Filipe Marcelino
 
Back
Top