开发者

c# application what are the advantages to running as a service?

i will have a c# a开发者_运维技巧pplication that will get data from a timeclock and send an email to every employee biweekly.

what are the advantages to having the application automatically run as a service?


It doesn't require a user to be logged in, and can be configured to run under an account/permission set of your choice. Applications, such as this one (from the description), which are meant to be "always-on" tend to make the most sense as a service.

However, if you are doing something that will run biweekly, you might also want to consider a console application running as a scheduled task. This has the advantage of allowing the app to be run as needed, and not stay resident in memory. This is better in terms of system resource utilization. It also makes "reconfiguration" of the schedule very easy, since it requires no change in the application itself.


  • it runs without anyone being logged on (e.g. on a server) after bootup - no need to launch it, etc.
  • you can easily start, pause, stop it
  • you can make it run under a given service account


If it is run as a service, no user has to be logged in, it can auto restart and runs as SYSTEM with full privileges to the system.


  • Does not interact with the desktop
  • Can run under low privilege account, so if compromised, damage can be limited
  • Does not need a user to log in in order to run


I think you answered your own question.

If your application runs automatically as a service, it will start itself whenever the server starts. It can then periodically check the time to determine if it's supposed to execute whatever its job might be.

The key benefit is that it runs automatically, without having to task Bill (or whomever) with the job of loading the program and twiddling his thumbs while it executes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜