I have started working with the C# from couple of months and now i am starting with the windows service. MSDN is good as always to start with but i would like to know if there is book, blog ... etc (dedicated) for this which could be a nice starting point ?
I found the following useful to me when I started making services:
It the same as a console app, just without a console (and a little extra setup).
I have written many console apps that can run as a service too, you can achieve this in less than 5 lines of code.
Your best bet is just to use the default VS template for a service, and see how little difference there really is.
There are some things to watch out for however.
- Your service needs to do something, else it will just exit after starting. I normally just start off another thread with the workload.
- You need to be able to stop your service. Using a thread as above provides an ugly but foolproof way.
- Services can't (or should not) interact with the desktop.
What is the reason for choosing windows services as you execution environment? Generally, these are avoided if possible (particularly for people new to .NET). They can be sort of cranky and are rather opaque. By all means, if your requirements neccesatate a windows service, go for it, but if not, I'd start elsewhere.
If you want to create a Windows service using C# with Visual Studio 2008, you can follow the step-by-step instructions here.