By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 1,973 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

Monitoring windows services

P: n/a
BC
Hi all,

I have a windows service (on client machine) that monitors a MSMQ queue
(on server machine). When a new message is in the server queue, the
client windows service will get the message and does some process.
What I want to do now is create a small windows application that sits on
the client machine and monitor the activities of the windows service.
I am using Visual Studio .NET 2003 with C#.
The question is how can I monitor a windows service? Any related
articles will be great.
Cheers,

Benny

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"BC" <no****@devdex.com> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I have a windows service (on client machine) that monitors a MSMQ queue
(on server machine). When a new message is in the server queue, the
client windows service will get the message and does some process.
What I want to do now is create a small windows application that sits on
the client machine and monitor the activities of the windows service.
I am using Visual Studio .NET 2003 with C#.
The question is how can I monitor a windows service? Any related
articles will be great.
Cheers,

Benny

*** Sent via Developersdex http://www.developersdex.com ***


What exactly do you mean with "monitor", if you didn't implement your
service such that it could be monitored there is very little to be
monitored. Sure you can control the state of the service, like starting
stopping etc. but if you need to monitor it's activity you should expose
some objects and/or counters data, lets say the number of MSMQ processed
sent so far.
You have several options depending on your requirements, but you will need
to add some code to your service; the easiest is to publish performance
objects through private performance counters and use the performance monior
to watch these counters.
Another option is to use System.Management classes to expsose performance
objects or state info by publishing these objects through the WMI system,
this is the way most Msft services like IIS, ASP.NET, SQL Server... publish
their state/performance data. Any client (.NET using System.Management and
others using COM and or scripting) can be built to query the exposed
objects. Note that the latter option can also be used to manage the service.
Willy.
Nov 17 '05 #2

P: n/a
BC
Hi Willy,

Thanks for the reply. Basically what I want is awindows application that
allows me to monitor the activties (performance, exception errors...
etc) of a windows service that will be also create by me.
Cheers,

Benny

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3

P: n/a
BC wrote:
Thanks for the reply. Basically what I want is awindows application
that allows me to monitor the activties (performance, exception
errors... etc) of a windows service that will be also create by me.


The best way to do monitor information is to add performance counters to
your service and use the performance monitor in XP.

The event log was designed to be the place for messages (like exception
details) from services. Unfortunately Microsoft provided a really bad
implementation of the code to log an event in v1.0 and v1.1, so I never
recommend people use the EventLog class to log events. The version of
this class in v2.0 is much better, and you can use it to log events
correctly, but unfortunately it also allows you to log events in the
incorrect way :(

Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.