473,775 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A windows service question

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
Aug 17 '06 #1
4 1134
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" <Go****@discuss ions.microsoft. comwrote in message
news:7D******** *************** ***********@mic rosoft.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

Aug 17 '06 #2
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
Aug 17 '06 #3
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:
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
Aug 17 '06 #4
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
--
Gordon
"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" <Go****@discuss ions.microsoft. comwrote in message
news:7D******** *************** ***********@mic rosoft.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


Aug 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7191
by: Eric Chong | last post by:
I created a Windows Service in C# that requires to get passed command arguments like a Console App. I noticed that there is an option "Start parameters" text box in the property of a Windows Service in MMC. Is there any way to get arguments using this option? If possible, what framework method should I use to get an arguement? Thanks in advance. Eric
4
7149
by: Bill Sonia | last post by:
I'm written a Windows Service to send e-mails on events like OnStart, OnStop, OnShutDown using System.Web.Mail. It works for everything but OnShutdown. My guess is that once my send mail code is executed, other necessary Windows Services have been terminated before it can actually send the mail. I've updated my HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services registry DependOnService value including SMPTSVC and others. My hope is...
5
14125
by: Richard Steele | last post by:
I have created a WinForm application that needs to be run as a windows service (the PC is inaccesible by any user) i have successfully installed the application as a windows service. When i start the service, i get the following error Error 1053: The service did not respond to the start or control request in a timely fashion 1. Is there anyway to extend the timeout period.? I use timed threads to load a serial device driver and this...
17
6443
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
2
6900
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app (which is the UI used to adjust the actions taken by, and the schedule of the service), then a privileged user thread should be used in the UI - no service required. But... "A windows service enables the creation of long-running executable
2
2259
by: shyam | last post by:
I have a C++ COM based windows service which have more than 30k lines of code and which is stablized over years. We need to take the advantage of the ..NET framework for this project, especially the GUI for this service and the other windows non gui .NET clients. What's the best migaration pattern for us considering not to rewrite the thousands of lines of code. The question i have are the follows.
5
606
by: Tom | last post by:
Using multiple System.Timers.Timer objects in a Windows Service for performing multi-thread activities in a periodic fashion. Timers are AutoReset=false, to only have a single timer execution thread running at any given moment. Typically, timers will have an interval of 5 to 15 minutes. Conditionally, the interval may be set to 1 second (1000 ms) before the next call to Timer.Start(). Here is the question: if the interval is one...
2
2828
by: =?Utf-8?B?Sm9obiBG?= | last post by:
Hello All, I have a question about using an ActiveX control with a Windows Servce in C#. I believe it is not possible to properly setup an ActiveX control in a windows service as the particular ActiveX control we're using (GrFinger for fingerprint reader)implements several event handlers. It is also my understanding that there is no Message Pump within a Windows Service. I suppose I could create my own message pump, but this seems...
41
11663
by: pbd22 | last post by:
Hi. I know my windows service works when i run it in debug mode on my dev machine. It also works in release mode on my dev machine. But, when I move the service to a production server, it exits immediately with a start/stop/nothing to do error. What could be wrong?
5
3307
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4014
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.