I developed a Windows service using vb.net which does the following using OnStart Even…
- Grabs all Entries from a SQL Table
- Creates Schedules from returned rows
it works fine, schedules fire on their time and stuff.
Problem: Whenever I have to ADD a new row to my Table, I have to restart the Service, So it can Grab the Newly created rows. This is causing problems for me…there could be a task which is running already and restarting service might break the system.
So what is the best way to handle this? Can the new rows be loaded into Service without a restart?
Thanks
This OnStart was provided here by Marc Gravell:
Note that
OnStartcan launch multiple threads or the first thread started may be used to start additional threads as needed. This allows you to set up either database polling or a thread that waits on a message queue for data.A useful tip:
Adding a
Mainto your service allows you to run it as a console application in Visual Studio. This greatly simplifies debugging.