Windows Service

  • Thread starter Thread starter Andrea Caldarone
  • Start date Start date
A

Andrea Caldarone

Hi all,

I have SQL Server Agent and under it I've some jobs that runs with a definde
schedule (they can run at the same time).
SQL Server Agente doesn't belongs to SQL Server Express edition, so I'm
lookig for a way to build a such schema with a .net windows service.
Let's say I need 10 jobs:

1) it is better to have 10 windows services?
2) it is better to have 1 windows services with 10 threads?

in the first case, I need to have 10 different project that installs 10
different services with 10 different name (it is correct?)
in the secound case, how can I tell the service (from the outside) to
start/stop a single thread? I need to use remoting...

Any suggestions are well accepted.
 
Andrea Caldarone said:
Hi all,

I have SQL Server Agent and under it I've some jobs that runs with a
definde schedule (they can run at the same time).
SQL Server Agente doesn't belongs to SQL Server Express edition, so I'm
lookig for a way to build a such schema with a .net windows service.
Let's say I need 10 jobs:

1) it is better to have 10 windows services?
2) it is better to have 1 windows services with 10 threads?

in the first case, I need to have 10 different project that installs 10
different services with 10 different name (it is correct?)
in the secound case, how can I tell the service (from the outside) to
start/stop a single thread? I need to use remoting...

Any suggestions are well accepted.
I believe it would be much better to have a single service. A windows
service must contain at least a single thread. The OnStart Method of a
service lets you call to a Method (via AddressOf). From there you can decide
how to handle the 10 jobs
 
Andrea said:
Hi all,

I have SQL Server Agent and under it I've some jobs that runs with a
definde schedule (they can run at the same time).
SQL Server Agente doesn't belongs to SQL Server Express edition, so I'm
lookig for a way to build a such schema with a .net windows service.
Let's say I need 10 jobs:

1) it is better to have 10 windows services?
2) it is better to have 1 windows services with 10 threads?

You should have one service that has 10 threads.
in the first case, I need to have 10 different project that installs 10
different services with 10 different name (it is correct?)

Yeah, but you should have 10 threads on timers that go to sleep on
different intervals.
in the secound case, how can I tell the service (from the outside) to
start/stop a single thread? I need to use remoting...

No you don't need remoting. You can have a Windows form application in
contact with the Windows service application, sending custom commands to
the service.

<http://arcanecode.com/2007/05/30/wi...ding-commands-to-your-windows-service-part-7/>

You should be able to find VB examples.
 
The OnStart Method of a service lets you call to a Method (via AddressOf).
Can you provide a reference where this topic can be researched
further. I have not found any information about this using Google.
Thanks! Saga
 
That was based on the book "Programming Windows Services with
Microsoft Visual Basic 2008" by Michael Gernaey

I had a look at that book. It looks like itcovers the subject matter
quite thoroughly, but before making a purchase make sure to read
Eric Siron. At $140 USD plus $4 shipping it seems like quite a
bargain. Thanks for the tip! Saga
 
I had a look at that book. It looks like itcovers the subject matter
$140? No.

Yes... if and only if a dot is inserted between the 1 and the 4. My
fingers humbly apologize for leaving out this all important character.
I just checked Amazon: Used $1.23, New $1.39 USD, plus shipping.
That review is pretty fair. There were a number of typos that I caught
and fixed while using the code. He also covers fair amount of stuff
that isn't about writing servcies as much as it is generally good
programming patterns - like using resource files and such.

But it does cover the basics of writing windows services and I could
figure out the rest once I got that down.
Thanks again for the added input. I will having a closer look at this book.

Also, I am reading the doc that is in the ZIP file that you referenced.
That poor cat! Regards, Saga
 
If you want a Windows Service then start with a console application.

Adding threads to that is very easy.

All you have to do when you want it as service is to change the Project
properties, add a Windows Service Installer project, and then to install it
using the CommandLine Service Installer on MSDN.
 
Back
Top