Click here to Skip to main content
11,790,816 members (54,994 online)
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 1: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 OriginalGriff 385
1 ppolymorphe 339
2 Richard MacCutchan 118
3 Maciej Los 70
4 George Swan 70
0 OriginalGriff 1,154
1 Maciej Los 825
2 KrunalRohit 686
3 ppolymorphe 660
4 CPallini 621

Advertise | Privacy | Mobile
Web03 | 2.8.1509028.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