Solved

why to use windows service

Posted on 2014-10-02
6
41 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
  • 3
  • 2
6 Comments
 
LVL 32

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 32

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 32

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now