|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
A windows service questionI have developed a VB.net app in a module that queries a database, loads the data into several arrays and then loops through the array. It then compares time data stored in the array with the current system time. If there is a match a program is then started. The apps purpose is be like the windows task scheduler. And I want to run it as service because it will run continuosly. I can't seen to find an example of where an app like this is made a service. Most of the examples of candidates for services a like a special backup routine or to monitor a specific process. So could I run my app as a service ? If so do I transfer my code which now exists in the main() sub and a function into the service class of a service project ? Or can I call my module from the OnStart Sub ? Thanks for any insights, -- Gordon I don't see why your app can't run as a service, so long as you design it
properly. You'll also have to make sure it runs under the proper Windows account to access external data (like your database.) Have a look at this program I wrote that runs as a Windows service: http://spamgrinderprox.sourceforge.net/ Show quoteHide quote "Gordon" <Gor***@discussions.microsoft.com> wrote in message news:7DE20DEA-EB59-4675-86CB-5F602A6719A9@microsoft.com... > Hi; > > I have developed a VB.net app in a module that queries a database, loads the > data into several arrays and then loops through the array. It then compares > time data stored in the array with the current system time. If there is a > match a program is then started. The apps purpose is be like the windows task > scheduler. And I want > to run it as service because it will run continuosly. > > I can't seen to find an example of where an app like this is made a service. > Most > of the examples of candidates for services a like a special backup routine > or to > monitor a specific process. > > So could I run my app as a service ? > > If so do I transfer my code which now exists in the main() sub and a > function into > the service class of a service project ? Or can I call my module from the > OnStart Sub ? > > Thanks for any insights, > > -- > Gordon Hi;
My routine seems to be working OK with this line : Sub onStart() Process.start("exe to start") ????????????? End sub The exe that is called functions much like a timer in that it compares a datetime value to Now() and responds to a match of those times. Thanks -- Show quoteHide quoteGordon "Mike Lowery" wrote: > I don't see why your app can't run as a service, so long as you design it > properly. You'll also have to make sure it runs under the proper Windows > account to access external data (like your database.) > > Have a look at this program I wrote that runs as a Windows service: > http://spamgrinderprox.sourceforge.net/ > > "Gordon" <Gor***@discussions.microsoft.com> wrote in message > news:7DE20DEA-EB59-4675-86CB-5F602A6719A9@microsoft.com... > > Hi; > > > > I have developed a VB.net app in a module that queries a database, loads the > > data into several arrays and then loops through the array. It then compares > > time data stored in the array with the current system time. If there is a > > match a program is then started. The apps purpose is be like the windows task > > scheduler. And I want > > to run it as service because it will run continuosly. > > > > I can't seen to find an example of where an app like this is made a service. > > Most > > of the examples of candidates for services a like a special backup routine > > or to > > monitor a specific process. > > > > So could I run my app as a service ? > > > > If so do I transfer my code which now exists in the main() sub and a > > function into > > the service class of a service project ? Or can I call my module from the > > OnStart Sub ? > > > > Thanks for any insights, > > > > -- > > Gordon > > > Hi;
After a little VS documentation research could this statement be all that is needed to start my app? Sub onStart() Process.start("exe to start") ????????????? End sub Is this the correct way to sstart an app in service ? Thanks, -- Show quoteHide quoteGordon "Gordon" wrote: > Hi; > > I have developed a VB.net app in a module that queries a database, loads the > data into several arrays and then loops through the array. It then compares > time data stored in the array with the current system time. If there is a > match a program is then started. The apps purpose is be like the windows task > scheduler. And I want > to run it as service because it will run continuosly. > > I can't seen to find an example of where an app like this is made a service. > Most > of the examples of candidates for services a like a special backup routine > or to > monitor a specific process. > > So could I run my app as a service ? > > If so do I transfer my code which now exists in the main() sub and a > function into > the service class of a service project ? Or can I call my module from the > OnStart Sub ? > > Thanks for any insights, > > -- > Gordon Gordon,
No, that's not the right way. You're right about needing place code in the OnStart method though. What you need to put there should get everything going. Sometimes that is as simple as starting a timer and sometimes it may require starting a new thread. In your case it sounds like kicking off a timer will work well. In the timer event you'll use the code you already have to query the database, etc. and then kick the task off with Process.Start. Brian Gordon wrote: Show quoteHide quote > Hi; > > After a little VS documentation research could this statement be all that is > needed to start my app? > > Sub onStart() > Process.start("exe to start") ????????????? > End sub > > Is this the correct way to sstart an app in service ? > > Thanks, > > -- > Gordon > > > "Gordon" wrote: > > > Hi; > > > > I have developed a VB.net app in a module that queries a database, loads the > > data into several arrays and then loops through the array. It then compares > > time data stored in the array with the current system time. If there is a > > match a program is then started. The apps purpose is be like the windows task > > scheduler. And I want > > to run it as service because it will run continuosly. > > > > I can't seen to find an example of where an app like this is made a service. > > Most > > of the examples of candidates for services a like a special backup routine > > or to > > monitor a specific process. > > > > So could I run my app as a service ? > > > > If so do I transfer my code which now exists in the main() sub and a > > function into > > the service class of a service project ? Or can I call my module from the > > OnStart Sub ? > > > > Thanks for any insights, > > > > -- > > Gordon
Best Practice Error Handling
Programmatically Crawl a DLL's Namespacec A little help with an array & 'NullReferenceException was unhandled' ?? Is there a repeat characters function? VB 2005 Syntax Data Binding with CSV Files Withevents work AddHandler dont? dynamic main menu String function in VB vb.net richtextbox selectionstart coloring |
|||||||||||||||||||||||