473,783 Members | 2,317 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 8596
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
10984
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
7028
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
7273
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
1496
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
6532
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
4387
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
7379
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
1772
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
2042
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...
1
10081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
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
8968
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
7494
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
6735
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();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4044
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
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.