Alex Gordon
Alex Gordon

Reputation: 60731

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

i will have a c# application 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?

Upvotes: 2

Views: 761

Answers (5)

Randolpho
Randolpho

Reputation: 56391

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.

Upvotes: 1

Reed Copsey
Reed Copsey

Reputation: 564413

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.

Upvotes: 13

spender
spender

Reputation: 120450

  • 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

Upvotes: 1

Byron Whitlock
Byron Whitlock

Reputation: 53861

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.

Upvotes: 1

marc_s
marc_s

Reputation: 754468

  • 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

Upvotes: 3

Related Questions