Windows Service or Scheduled Task, which one do we prefer?

后端 未结 10 1827
时光取名叫无心
时光取名叫无心 2020-12-16 12:07

If we need to write a program that works periodically, which way do we prefer? Writing a windows service or writing a console application which works as scheduled task?

10条回答
  •  情歌与酒
    2020-12-16 12:56

    I think a service might be useful if you want to use WCF or .NET Remoting and have client applications communicating with some host service; otherwise I agree that a scheduled task is preferable to a service if the more complicated service adds nothing new.

    And @Tom, his statement about having to stay logged into a computer for a scheduled task to run is false. I just tested myself, and confirmed that a Windows schedule task will still run even if you're not logged in (unless of course you select the option that the task only runs while you're logged on).

提交回复
热议问题