Juni Juni - 13 days ago 8
C# Question

Is it good to have windows service or console application?

I have a tasks table in my db. I want to read data from this table and run tasks. Which one is better whether to have it as windows service or a console application running. The server on which this will be run will not be shutdown

Answer

You most likely want to use a windows service.

Benefits:

  • You can control the user (and the rights associated with this user account) which starts the process
  • An automatically started process means the desktop need to be on, not user logged, for the service to run
  • A policy on failure can be defined (try to restart n times run a specific program if fails)
  • A dependency can be defined (if you depend on other sevices)
  • You can wrap your script in an invisible window
  • You can easily start/stop/restart the script (net start <scriptname>)

Quoted from here: What is the benefit of developing the application as a windows service?