Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Benefits of console app over windows service

Tags:

.net

I have a .Net console App which using a scheduled event will start, call a mweb service method and the close. This runs every hour/every day. Whilst there is nothing 'wrong' with the implementation I was wondering if there was any benefit to implementing this as a windows service.

Has anyone any views of what would be the best practice in this case?

like image 290
Dean Avatar asked Jan 21 '09 12:01

Dean


People also ask

What is the difference between console application and Windows service?

The key difference between a process running as an app versus as a service is that the service can operate entirely outside the normal association with a user and session. Thus services can run such that they start before any user logs in and can continue running after users log off.

Why do we use console application?

A console application is primarily designed for the following reasons: To provide a simple user interface for applications requiring little or no user interaction, such as samples for learning C# language features and command-line utility programs.

How does console program application differ from Windows program application?

The sole difference is that a console application always spawns a console if it isn't started from one (or the console is actively suppressed on startup). A windows application, on the other hand, does not spawn a console. It can still attach to an existant console or create a new one using AllocConsole .

What are the benefits of Windows services?

Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface.


1 Answers

I Find Windows services hard to debug so I tend to only use them when:

(A) What I am doing is quite complex or

(B) needs to be running all the time(Example: Monitoring something for changes)

I find most things can usually be accomplished with a Console App some command line args and the Windows Scheduler.

like image 146
cgreeno Avatar answered Sep 17 '22 16:09

cgreeno