473,729 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Service or Console application

I want to develop and application that run periodically in the server
machine. Now Should I go for a windows service or just create a Console
application and schedule it using the windows Task Scheduler.

What are the advantages and disadvantages of each approach.
Thanks
Krish

Dec 19 '06 #1
6 8594
Hello, Krish!

services are there to run for a long time and before any user logged in.

IMO it would be far more simple to do this via console application

You wrote on 19 Dec 2006 04:13:02 -0800:

KI want to develop and application that run periodically in the server
Kmachine. Now Should I go for a windows service or just create a
KConsole
Kapplication and schedule it using the windows Task Scheduler.

KWhat are the advantages and disadvantages of each approach.
KThanks
KKrish
With best regards, Vadym Stetsyak.
Blog: http://vadmyst.blogspot.com
Dec 19 '06 #2
So you mean .. for windows scheduled task to run someone should be
logged in to the to server, but for the service it will run even if
there is no user logged in?

The advantake I see for the scheduled task is, it is easier to change
the schedule from the UI unlike a service(you may have to use config
file for the same).
Vadym Stetsyak wrote:
Hello, Krish!

services are there to run for a long time and before any user logged in.

IMO it would be far more simple to do this via console application

You wrote on 19 Dec 2006 04:13:02 -0800:

KI want to develop and application that run periodically in the server
Kmachine. Now Should I go for a windows service or just create a
KConsole
Kapplication and schedule it using the windows Task Scheduler.

KWhat are the advantages and disadvantages of each approach.
KThanks
KKrish
With best regards, Vadym Stetsyak.
Blog: http://vadmyst.blogspot.com
Dec 19 '06 #3
Hello Vadym,
>services are there to run for a long time and before any user logged in.

IMO it would be far more simple to do this via console application
In many ways you may be correct in saying that it's simpler to use a
console applications. But writing applications is often not about the
simplest approach, but rather about satisfying criteria.

What you're saying first is important: services run when nobody is logged
in. As the OP was talking about a "server machine", I assume that this
could very well be an important feature.

In my experience, the best way to go is this:

* Pull out the core functionality of your service into a class library assembly

* Create a console application that utilizes the functionality in the library. This application can easily be debugged and tested, without the additional requirements and complications of the service.

* Create a Windows service that utilizes the functionality of the library as well. Deploy this, or maybe deploy both this and the console application - sometimes both can make sense.

The overhead of creating two different executables is typically minimal,
if you do a good job of moving all actual functionality into the library
assembly. Each of the executables usually ends up having just a very small
number of lines of code, for example to parse command line options or to
set up logging options.
Oliver Sturm
--
http://www.sturmnet.org/blog
Dec 19 '06 #4
Hello Oliver
> * Pull out the core functionality of your service into a class library assembly
I was planning to do this way only. But as this is an admin
functionality If I host this as a windows service the admin will ask
for a UI to change the schedule as desired. If we are using the windows
scheduler, then a separate UI is not required.

What do you say?
Regards
Krish

Dec 19 '06 #5
It depends on what its trying to do - things with interfaces or network
calls for example are really tricky as services so I tend to use them when
the remit of whats its doing is really quite simple, like monitoring
something locally. Windows services are harder to work with, debug and test
and limited by the account they run under where a scheduled service can very
easily be switched to any account in the scheduler interface. Console is
usually the easier of two approaches if theres little difference between
them as it costs less in time and effort to create, and inevitably will be
easier to support.
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Krish" <ba****@gmail.c omwrote in message
news:11******** *************@j 72g2000cwa.goog legroups.com...
>I want to develop and application that run periodically in the server
machine. Now Should I go for a windows service or just create a Console
application and schedule it using the windows Task Scheduler.

What are the advantages and disadvantages of each approach.
Thanks
Krish

Dec 19 '06 #6
Hello Krish,
>I was planning to do this way only. But as this is an admin
functionalit y If I host this as a windows service the admin will ask
for a UI to change the schedule as desired. If we are using the windows
scheduler, then a separate UI is not required.
Fair enough, I take your point.

I have implemented that kind of interface in the past and it wasn't too
hard, and it can also be a good thing because I find that the requirements
of scheduling in server software are often not really covered by the
Windows scheduler. Implementing my own interface allows me to have exactly
the right functionality covered, which helps reduce confusion. That said,
of course it takes time - no question about that.
Oliver Sturm
--
http://www.sturmnet.org/blog
Dec 19 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
10982
by: Chris | last post by:
Hi, Currently, I have a console application written in C# and an unmanaged legacy DLL written in VC++ 6.0. In the DLL's previous application, when an event occurs in the DLL, a windows message would be sent to the host GUI application via PostMessage to WM_USER + X. The GUI application would then execute a function to retrieve data from the DLL. With this new setup, I have a console application as the host. I retrieved the handle...
9
7023
by: Hardy Wang | last post by:
Hi all: I read an article from http://www.c-sharpcorner.com/Code/2003/Sept/InstallingWinServiceProgrammatically.asp about how to install a windows service programmatically. Based ont the code sample, it provides the feature to install service under LocalSystem account. What I need is to install service under some other certian account. By further studying the code, and MSDN...
7
712
by: Mike | last post by:
I want to create a windows service that will monitor another window service. what i need for the service to do is, if a service is stopped I need it to start the service back up example: service 1 - my service watches service 2 - windows service service 2 is stopped - service 1 starts service 2
9
7271
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service stopping. Please advise how to stop the service. Thanks, SP
3
1495
by: John Fred | last post by:
Salve, I have write a service Windows for the remoting. I have a dll Server (OLD COM+) For Configure DLL Server I user Config File Es. <configuration> <system.runtime.remoting> <application>
12
6528
by: Noam | last post by:
I had originally written a program as a c# console application. The program used a reference that I wrote in c++. Later I was told to re-write the application as a windows service. When the service would start up, as soon as it accessed the reference (by instantiating a class within the reference), the service would crash. In the event viewer I saw that it throw a System.IO.FileNotFoundException saying that the c++ reference was missing...
7
4377
by: sunil | last post by:
Hi all, I read an article from http://www.c-sharpcorner.com/Code/2003/Sept/InstallingWinServiceProgrammatically.asp about how to install a windows service programmatically. Based on the code sample, it provides the feature to install service under LocalSystem account. What I need is to install service under NT AUTHORITY\NetworkService, so that my service can access the shared network resources.
28
7372
by: | last post by:
I have a multi threaded windows form application that runs great after calling Application.Run(). Application.Run is required for a COM component I a using in the app (required for message loop). I have created a windows service from VStudio 2005 template. What is the windows service replacement for Application.Run()?
1
1771
by: jehugaleahsa | last post by:
Hello: I wrote an .exe that I would like to be called by a service I am deploying to a server. However, I am not sure how to tell the setup project to include the .exe. Also, I do not know how to tell the service where the .exe actually resides on the server. I would like to prevent hard-coding it since the software will be distributed to different offices in my company.
2
2040
by: pankajprakash | last post by:
Hi All, I have a asp.net web service and I am running an .exe file though this web service. The web serivce is calling that .exe file (console application) and running the code of that console application successfully. I have written console.readline in the console application. The problem is that when I run this web service in the windows XP is show that console application, however when I run in the Windows 2003 this also call that console...
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9281
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.