Solved

To service or not to service

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

705 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