What are the advantages and disadvantages of creating a Windows service

1

I want to know the advantages and disadvantages of creating a Windows service and if:

  • If it is easy to maintain;
  • If anyone ever had problems with this;
  • If you require any specific knowledge, other than the programming language.
asked by anonymous 20.11.2017 / 13:16

2 answers

4

Advantages:

  • It is controlled by the operating system and can start automatically in boot or on demand or restart when there is a failure and can be done remotely directly
  • You do not need a logged in user to run it and it can impersonate other users
  • Have more control over security and access control
  • Not visible
  • Can not be closed by normal means, but can be controlled even better than a normal application, including easily stopping a hanging process, and can control and monitor all this

Disadvantages:

  • Can not run more than one instance
  • Usually needs administrator privilege and needs an installation of it and of course, an update is not as simple as overlapping an executable
  • It is more complicated to develop and debug, if you can not do it right and understand what has to be different can be problematic (not usually a good idea for those who do not master software development very well unless they do something trivial)
  • Does not interact with user

You need to know the entire API of the services and the peculiarities that it requires.

    
20.11.2017 / 15:40
3

Just complementing what Maniero said:

Maintenance level: Maintaining a service (from my point of view) is as simple as a VCL application. Since the service typically runs on only one machine, upgrade issues are rare. Having a legal plan for updating (not making changes at the time the service is most used) is a great start. The code used in a visual application is the same as that used in a service. So there are not many problems about that. For debug I particularly find it annoying. In my cases, I had to create compilation directives for these situations, nothing too complex, just "boring".

Problems faced:

1: Problems trying to install service through command WinExec (I was able to resolve using ShellExecute ) #

20.11.2017 / 17:17