Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VB8.0
How to convert console application to run as a service? I have the console application working, how to make the same application to run as a service??
Posted 26-Apr-11 2:04am
Nishant Sivakumar at 26-Apr-11 7:53am
Reasonable question. Voted 5 to counter the 1 vote.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

It depends on what your console app does right now. Typically you'd need a service if you need some kind of TCP service, remoting server, WCF service etc. Essentially you have code that can be activated when desired. Since you've asked this question I guess we can assume that right now you have a console app, that blocks (perhaps on a key-press) and keeps a thread alive. If so, follow Nijboer's suggestions. If not, you need to explain what you are trying to achieve.
Based on OP's comment, here's a link to an article that shows how to create and install a service using VB.NET:[^]
Gokulnath007 at 26-Apr-11 7:50am
My Console application will take screenshots in the interval of 10 seconds and stores it in the local drive. I want my console application to run as a service. How to do it?
Nishant Sivakumar at 26-Apr-11 7:52am
It will teach you how to create and install a service using VB.NET.
SAKryukov at 26-Apr-11 16:49pm
Good points, my 5.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You simply create a service project and instead of writing to the console you write to the message log. There are many examples/articles on how this can be done.
Good luck!
SAKryukov at 26-Apr-11 16:48pm
By far not that simple (don't create delusions), but the idea of using message log is right. My 4.
E.F. Nijboer at 27-Apr-11 5:09am
That's very correct, except that are the simple steps to take to start off. Just pointing them in the right direction, leaving room to find out the details about it. When someone will get stuck, then they can ask again about that.
SAKryukov at 27-Apr-11 11:10am
Oh, sure, no doubt against your approach. I only suggested not to create the delusion of simplicity. Log is not the main output which is in console application. All I/O is network of pipes or something -- IPC; and the methods are way more complex.
E.F. Nijboer at 27-Apr-11 11:21am
Very correct, but that is mentioned in most of the articles about them, like this one (but I understand your point):
SAKryukov at 27-Apr-11 15:16pm
Sure. It this article is good, it belongs to the body of your answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 719
1 CPallini 245
2 CHill60 240
3 TheRealSteveJudge 240
4 Peter Leow 205
0 Sergey Alexandrovich Kryukov 9,078
1 OriginalGriff 6,771
2 Peter Leow 4,282
3 Zoltán Zörgő 3,809
4 Richard MacCutchan 2,661

Advertise | Privacy | Mobile
Web01 | 2.8.150128.1 | Last Updated 26 Apr 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100