Solved

To service or not to service

Posted on 2006-06-22
4
179 Views
Last Modified: 2010-09-16
Hi experts,

What are the main advantages of writing a service application as opposed to a window-less application that rus in the background?

I wrote an application in Delphi that checks every 2 minutes a page on the internet and takes action depending on the content of that page. I tried to convert that application into a service but couldn't get it working (my incompetence, no doubt). However, as an "invisible" aplication that gets launched from the Startup folder it does everything I want it to do (for now).

Should I be pragmatic and leave it as it is, or are there any pressing reasons to make it a service application?
Are there any performance considerations? The application does a "while not <condition> do sleep(1000);" loop. Would that be less demanding on the resources if it were a service application?

thanks,
Michiel
0
Comment
Question by:altiplano
4 Comments
 
LVL 28

Accepted Solution

by:
ciuly earned 50 total points
ID: 16958353
service applications are good mostly for server-like applications, monitoring of some kind, but the most important aspect maybe, is that a service does not require a user to be logged in. so if you need the application to run even if no use is logged in, then you want to make it a service. If on the other hand, you want the application to only run for a sepcified user, then it should not be a service (you can't have 2 or more instances of the same service).

for your particular case, it can be a service, BUT, depends what the "take action" means. if it is to notify the user or otherwise interact with the user, then NOT a service.
0
 
LVL 4

Assisted Solution

by:kenpem
kenpem earned 25 total points
ID: 16961713
I would leave it alone as an invisible app - services can be painful to debug if something goes wrong and there doesn't seem to be any big advantage in this case. If it ain't broke.....
0
 
LVL 17

Assisted Solution

by:TheRealLoki
TheRealLoki earned 50 total points
ID: 16964627
If you create a service, that logs in as "local system" - "interactive" then you _can_ have it interact/notify the logged on user.
However, the "local system" account does not have certain network access and privileges.
Debugging can be a pain if you need to debug it as a service, but it is a simple matter to make a project that canbe run as a service _or_ an application just be using a compiler directive e.g. I use {$IFDEF APP} blah {$ELSE} blah...{$ENDIF}
If your project needs to check the "HKEY_CURRENT_USER" branch of the registry, ie. it is "user specific", then probably best not to make it a service

If you want a real easy way to turn your application into a service, you can just use SVRANY.exe to run your app as a service.
This is available in the windows resource toolkit, and probably a million places online.
0
 

Author Comment

by:altiplano
ID: 16966476
Thanks for the replies everybody. As my application needs to be aware of who the current user is, the conclusion from your comments is that it should NOT run as a service.
regards,
Michiel
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now