A service is different from an application in three ways:
- It runs without a user logged on to the system
- It can not have any user interface (the console is a UI too)
- It can run under elevated rights (SYSTEM account) and thus perform actions that are not allowed for users.
The questions to ask here is: Do you need the different options a service can give you? If the answer is no, then don't use a service.
I am inferring from your question that you need a background application without any user interface (item 2 above). You seem to have no need for items 1 or 3. You can get a pure background app without any window (console or else) by not creating one. Just create a simple Windows application and change
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
to
static class Program
{
[STAThread]
static void Main()
{
// Application.EnableVisualStyles();
// Application.SetCompatibleTextRenderingDefault(false);
// Application.Run(new Form1());
DoWhateverYouWant();
}
}
Oh yes, and Chris is completely right about debugging services being a real pain!