Hello Vadym,
services are there to run for a long time and before any user logged in.
IMO it would be far more simple to do this via console application
In many ways you may be correct in saying that it's simpler to use a
console applications. But writing applications is often not about the
simplest approach, but rather about satisfying criteria.
What you're saying first is important: services run when nobody is logged
in. As the OP was talking about a "server machine", I assume that this
could very well be an important feature.
In my experience, the best way to go is this:
* Pull out the core functionality of your service into a class library assembly
* Create a console application that utilizes the functionality in the library. This application can easily be debugged and tested, without the additional requirements and complications of the service.
* Create a Windows service that utilizes the functionality of the library as well. Deploy this, or maybe deploy both this and the console application - sometimes both can make sense.
The overhead of creating two different executables is typically minimal,
if you do a good job of moving all actual functionality into the library
assembly. Each of the executables usually ends up having just a very small
number of lines of code, for example to parse command line options or to
set up logging options.
Oliver Sturm