Monitoring output from service

G

Guest

Hello,

For security reasons, we need to start overhauling our old C++ applications
to run as services instead of applications running on the admin account. I
am re-writing these programs using C# now.

If I make a service out of ProcessApplicationA, how do I monitor what
normally would be going to the console output screen? I would like to be
able to pull up an application on my local computer which is somehow in
contact with all these little services and see the would be output for them
all.

Does anyone have any ideas how to do this? Should I start implementing
sockets and a host service to monitor output and serve it out to my machine?
Should I spit output from the little services to a txt file and let the host
program suck up the text and send it to my system through a socket?

Any suggestions are welcome.

Thanks,

Rob K
 
D

Dave Sexton

Hi Rob,

You could connect to your services through a remoting object, that you must
implement, and display the output to a console or any other target that you
would like. The Windows service, however, cannot display a console window
since Windows services run in the background with limited interface support.

Remoting on MSDN:
http://msdn2.microsoft.com/en-us/library/72x4h507.aspx

If you are only accessing the remoted objects from a single machine and you
are developing on the .NET 2.0 Framework then I suggest that you use an
IpcChannel for your remoting transport since it uses named pipes, only
accessible to clients running on the hosting machine, and is much more
efficient than sockets.

You can even use the System.ServiceProcess.ServiceController class to
control any Windows service from your own application.

- Dave Sexton
 
G

Guest

Hey thanks Dave! Very good information here. I didn't even know where to
start and this definately gives me a foot up.

We are preparing to work on the project next week or so... meanwhile I am
going to research what you have suggested.

Thanks again! We really appreciate it.

Rob K
 
M

Mike Blake-Knox

If I make a service out of ProcessApplicationA, how do I monitor what
normally would be going to the console output screen?

We have a somewhat similar need which we address by writing log/trace
information to a log file and viewing it. We are using the Apache
log4net logging package see http://logging.apache.com). This has the
advantage of keeping a record of what's going on in a plain text file
which can either be watched (and filtered) in real-time through a log
viewing program or edited with a text editor.

Hope this helps.

Mike
 
G

Guest

Thanks for replying Mike! I will look into this as well as soon as I can
migrate over to this project.

Rob K
 

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

Top