Hi,
I've written a windows service in VB.NET, which is set to automatically startup.
However, I am having a problem as it requires a connection to SQL Server at startup as it retrieves settings from a database table, but it is attempting to start before SQL Server, which is throwing an error because it can't access the database.
Is it possible to add dependencies to a service, so that it won't start without SQL Server?
An option I'm going to look into is adding a timer control to the application with an interval of say 2 minutes, when it ticks over it will carry on performing the required tasks to startup, but I'm unsure if this will work, and it might cause problems when installed on the server. I could also put in the error handling some code to say that if an error occurred whilst retrieving the settings then try again, but I'm worried this might cause an infinite loop if there is a problem with SQL Server and it doesn't start up.
Any advice would be much appreciated.
I've written a windows service in VB.NET, which is set to automatically startup.
However, I am having a problem as it requires a connection to SQL Server at startup as it retrieves settings from a database table, but it is attempting to start before SQL Server, which is throwing an error because it can't access the database.
Is it possible to add dependencies to a service, so that it won't start without SQL Server?
An option I'm going to look into is adding a timer control to the application with an interval of say 2 minutes, when it ticks over it will carry on performing the required tasks to startup, but I'm unsure if this will work, and it might cause problems when installed on the server. I could also put in the error handling some code to say that if an error occurred whilst retrieving the settings then try again, but I'm worried this might cause an infinite loop if there is a problem with SQL Server and it doesn't start up.
Any advice would be much appreciated.