Solved

To service or not to service

Posted on 2006-06-22
4
183 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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