Click here to Skip to main content
Rate this: bad
good
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
Comments
Nishant Sivakumar at 26-Apr-11 7:53am
   
Reasonable question. Voted 5 to counter the 1 vote.
Rate this: bad
good
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.
 
[Edit]
~~~~~~~~~~~
 
Based on OP's comment, here's a link to an article that shows how to create and install a service using VB.NET:
 
http://msmvps.com/blogs/joacim/archive/2009/09/13/creating-a-windows-service-using-vb-net.aspx[^]
  Permalink  
v2
Comments
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
   
See http://msmvps.com/blogs/joacim/archive/2009/09/13/creating-a-windows-service-using-vb-net.aspx
 
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.
--SA
Rate this: bad
good
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!
  Permalink  
Comments
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.
--SA
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.
--SA
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):
http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx
SAKryukov at 27-Apr-11 15:16pm
   
Sure. It this article is good, it belongs to the body of your answer.
--SA

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

  Print Answers RSS
0 OriginalGriff 195
1 Afzaal Ahmad Zeeshan 132
2 ProgramFOX 130
3 Maciej Los 105
4 Sergey Alexandrovich Kryukov 75
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,657
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 26 Apr 2011
Copyright © CodeProject, 1999-2014
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