Windows Services

Today I got to grips with my understanding of writing .NET windows service applications. Not that I’m unfamiliar with Services, I’ve written many services before using VC++/ATL, but I’m still a relative newcomer to .NET and so the .NET way is somewhat unfamiliar, its kind of fun though trying to map what I know with the way things are done in .NET.

One of the things I was puzzled about was how to interact with the service so that it could be monitored for state information and so on, controlling the service seems easy enough using the servicecontroller class, happily I stumbled on the notion of using WMI or performance counters to do the job. Sadly though the .NET implementation of WMI doesn’t seem to support writeable properties or methods, so that clients can set “WMI state” within the service publishing the WMI state or call WMI methods which the service could then react to, but hey ho, perhaps that will come in .NET 2.

The point of all this is to rewrite an existing VC++/ATL service application in C#, the rest it seems is just implementation detail, and happily .NET threading and the threadpool classes seem easy to use (I wasn’t looking forward to writing another threadpool implementation again as I had to for the old C++ version)

Published by

Phil Harding

SharePoint Consultant, Developer, Father, Husband and Climber.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.