Solved

To service or not to service

Posted on 2006-06-22
4
182 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:
2266180 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, DigitalPersona Fingerprint reader and MySQL 6 324
add combobox item based on numbers 9 154
update joined tables 2 55
Delphi problems to abort a printjob 9 24
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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