Today I built my first windows service in c#.
I have a few problems that I will be happy and thanksfull if you help me.
1)
When I install my service, it is runing and everything, but it wont show up in Windows Task Manager. any one knows why?
2) If I am trying to put a system tray, I can’t do it – because I cant put an icon. in window service there is no System.Drawing.. what can I do about it?
3)
protected override void OnContinue()
{
//eventLog1.WriteEntry("In OnContinue.");
}
What does this “OnContinue” does?
I was not able to understand it.
Service Not Showing up in Windows Task Manager
I’m assuming that you are running on Vista/Windows 7 and that your service is not running as your account. Because of that, you need to say “show processes from all users” on the “Processes” tab of Task Manager and you should see your service then (probably running under one of the default Windows accounts).
You won’t see your service in the “Applications” tab, services do not appear there.
Icon Tray for Windows Service
From Windows Vista on, a service is not allowed to interact with the desktop; even if you could still do this, which one do you interact with (there can be multiple users logged onto the machine with multiple desktops, think Terminal Server/multiple Remote Desktop Sessions)?
The way that you show an icon for the service is to create a program that communicates with your service (using something like WCF or Remoting) which is responsible for showing the icon in the tray.
Remember, your service more than likely doesn’t need an icon in the tray, create a plugin for the Microsoft Management Console instead and communicate with the service through WCF/Remoting.
OnContinue
From the documentation for the
OnContinuemethod:Basically, if your service can be paused (not stopped) then this is called when the service is resumed.