Windows Service Logging

  • Thread starter Thread starter Ron Bremmers
  • Start date Start date
R

Ron Bremmers

Hello,



I have a Windows Service which executes some code each 2 seconds.

Every 2 seconds I want to log the result in a Windows Forms application.
What is the best approach? I think it is .NET remoting, but when the
"client" application is not started, no logging has to be done. So the
service has to know if there is a client application to log to. How can I do
that? Any suggestions?



Thanks!



Ron
 
Ron,
You can use .NET Remoting: the Windows Service would have a single remoting
object that raises an Event.

The Windows Forms app would handle this event (remotely) when it is running.

The Service would simply raise the event, it doesn't care if there is any
one is handling the event or not.

In fact multiple Forms apps could handle the event, and they would all be
notified!

Matthew MacDonald's book "Microsoft Visual Basic .NET Programmer's
Cookbook" from MS Press has a topic on "Fire an Event over a Remoting
Channel" that shows how, plus information on how to enable 1.1 to work.

Alternatively you use Message Queuing (MSMQ) via the System.Messaging
namespace to send out messages, in this case I would have the message expire
in 2 minutes, not persist it, nor send it to the dead-letter queue, as the
message is simply notifying the client...

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top