?
Solved

To service or not to service

Posted on 2006-06-22
4
Medium Priority
?
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 28

Accepted Solution

by:
2266180 earned 200 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 100 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 200 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 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