Re: Windows Service or Console application
- From: "Oliver Sturm" <oliver@xxxxxxxxxxxx>
- Date: Tue, 19 Dec 2006 13:28:04 +0000
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
--
http://www.sturmnet.org/blog
.
- Follow-Ups:
- Re: Windows Service or Console application
- From: Krish
- Re: Windows Service or Console application
- References:
- Windows Service or Console application
- From: Krish
- Re: Windows Service or Console application
- From: Vadym Stetsyak
- Windows Service or Console application
- Prev by Date: Re: Windows Service or Console application
- Next by Date: Re: Windows Service or Console application
- Previous by thread: Re: Windows Service or Console application
- Next by thread: Re: Windows Service or Console application
- Index(es):
Relevant Pages
|