What are the advantages and disadvantages of creating a Windows service

Asked

Viewed 444 times

2

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

  • If it’s easy to maintain;
  • If anyone ever had a problem with that;
  • If you require any specific knowledge, apart from the programming language.

2 answers

5


Perks:

  • It is controlled by the operating system and can start automatically on boot or on demand or restarting when there is some fault and can be done remotely directly
  • No need to have a user logged to run it and can impersonate other users
  • Has more control over security and access control
  • Is not visible
  • It cannot 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 of this

Disadvantages:

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

You need to know all the services API and the peculiarities it requires.

4

Just complementing what Maniero said:

Maintenance level: Maintaining a service (from my point of view) is as simple as a VCL application. Since service usually runs on one machine only, upgrade problems are rare. Having a legal plan to update (not making changes to the time when the service is most used) is a great start. The code used in a visual application is the same code used in a service. So there are not many problems with that. To debug i particularly find it boring. 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 via command WinExec (I was able to solve using the ShellExecute) here has an explanation of the solution;

2: Windows did not start the service properly (it was necessary to format the station, but there was a lot of headache until I discovered that was it);

3: Beware of user who have "nervous fingers", try to encapsulate your service, with respect to leave as far away as possible from user.

Specific knowledge: It is very relative to say that you need or that you do not need knowledge in another language, it goes a lot of your need. If you are going to develop a service that forwards NFC-e in contingency, you need to have knowledge in XML and Web Services; For a service that generates text files for importing from another system, only basic knowledge. In the point of view menu, there is no pattern or logic that defines whether or not there is a need.

  • I wanted to know more about it to see if it was an advantage or not to create one... Thanks for the Explanation.

  • I will check the link and deepen more... Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.