Solved

why to use windows service

Posted on 2014-10-02
6
52 Views
Last Modified: 2015-02-23
hi

though i have used few windows services, yet i am not able to figure out , what specific problems it solves , and where specifically i should use them.

why not to use console app and put them in windows task scheduler rather.
0
Comment
Question by:BeyondBGCM
[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
  • 3
  • 2
6 Comments
 
LVL 34

Expert Comment

by:it_saige
ID: 40357005
The simplest answer is because services are generally application/programs/processes that run regardless of whether the user is signed in or not.  Another distinction is that *most* services, in general, need to run for as long as the operating system is loaded.

One example of this would be the Print Spooler:

Say that UserA needs to print and knows that UserB has a printer that is attached to his/her computer and that this printer is shared out for local network usage.  Now if UserB is not logged into his her computer, then something needs to be running on the computer to allow for a print request to be processed.  In this case, the Print Spooler service allows for UserA to send a print job to UserB's computer, the print spooler in turn sends the job to the target printer.  This process could not be accomplished by a scheduled task that is set to run as UserB because you never know explicitly when UserA will need to print.  Also, just leaving UserB logged in represents a hole in your security.

-saige-
0
 
LVL 34

Expert Comment

by:it_saige
ID: 40357017
Also in the above example, other services come into play that allow for UserA to send a simple print job to UserB's computer.

-saige-
0
 
LVL 40
ID: 40357163
Services are applications that look over other applications (such as an anti-virus program), or are used by other applications (such as SQL Server).

They cannot be started from the Task Scheduler, because you never know beforehand when they will be required.

At first sight, there are services that could be defined in a dll that runs only while an application uses it. Think of databases for instance. The Access database engine does not run continually on the computer, it is launched by the application that needs to Access the database, and then "dies" when the application stops.

You might Wonder why SQL Server runs as a service instead of doing the same thing that Access does. There are many reasons for that.

The main one is that it can be called from other computers. In order to do so, it needs to be ready to answer anytime.

On an individual station (SQL Server Express), because of all it does, SQL Server takes longer to start. It would slow down the first access to it from an application if an application needed to start it before using it.

Another one, more important that one, is that SQL Server still do work in the background even when applications do not use it. If it was to stop every time an application stops, it would not be able to do these background tasks efficiently.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:BeyondBGCM
ID: 40491910
bit different solution, i can use task scheduler to start an application every minute, which is same as windows service,
0
 
LVL 34

Accepted Solution

by:
it_saige earned 500 total points
ID: 40492109
But that is because Task Scheduler, itself, is a windows Service.

-saige-
0
 

Author Closing Comment

by:BeyondBGCM
ID: 40625741
if it is true , then it is the best answer to my question
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Duplicates in Aggregate Query 3 54
Slow process to read Excel 15 164
Windows ICD FFU Issue 4 106
Why use this lambda? 12 95
This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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