Windows Service vs Windows Application - Best Practice

前端 未结 3 515
无人共我
无人共我 2020-12-13 19:11

When should I go for a Windows Service and when should I go for a \"Background Application\" that runs in the notification area?

If I\'m not wrong, my design decisio

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 19:42

    I would design an application as a service if the applcation has a critical purpose and should never (or rarely) be closed. Windows services provide good crash-recovery options, good notifications (see the recovery tab in service property).

    Also a good reason to use services is because they can run under any user ( so if you deploy them on a server that you remote to, you can safely log out after starting the service without worring that the application will close too).

    I also design services in combination with a desktop application that can interact with the service and can be used to monitor or reconfigure the service while running. This way you can have all the benefits of a tray application, in your service.

    However, you should not abuse using services and only use them, as I said, for cirtical applications.

提交回复
热议问题