M
Mark Rae
Hi,
I'm looking for advice concerning what to do if a Windows service does not
find a "viable" working environment at startup.
E.g. I have a Windows service which does the following:
1) connects to a remote FTP site and looks for certain files which it
downloads to a fileserver if it finds them;
2) processes the files and writes their contents into various tables in
various databases on various servers;
3) generates a mail message containing various statistics to various
Exchange and POP3 mailboxes.
When it starts up, it calls a function which
1) attempts a logon to the remote FTP site;
2) tries to create (and then delete) an empty text file on the file server;
3) sends a test email to the network manager.
If any one of the above processes fails on startup, the service considers
that it doesn't have a viable working environment in which to run, so
disables the System.Timer object.
I've now been asked that this should actually stop the service altogether,
because the network has service monitoring software which would detect this
and send alerts etc.
Would you consider that this was a bit too drastic, and that the service
should continue to try to find a viable working environment, at least for a
specified number of times?
If not, what is the safest / cleanest way for a Windows service to shut
itself down?
Any asssistance gratefully received.
Mark
I'm looking for advice concerning what to do if a Windows service does not
find a "viable" working environment at startup.
E.g. I have a Windows service which does the following:
1) connects to a remote FTP site and looks for certain files which it
downloads to a fileserver if it finds them;
2) processes the files and writes their contents into various tables in
various databases on various servers;
3) generates a mail message containing various statistics to various
Exchange and POP3 mailboxes.
When it starts up, it calls a function which
1) attempts a logon to the remote FTP site;
2) tries to create (and then delete) an empty text file on the file server;
3) sends a test email to the network manager.
If any one of the above processes fails on startup, the service considers
that it doesn't have a viable working environment in which to run, so
disables the System.Timer object.
I've now been asked that this should actually stop the service altogether,
because the network has service monitoring software which would detect this
and send alerts etc.
Would you consider that this was a bit too drastic, and that the service
should continue to try to find a viable working environment, at least for a
specified number of times?
If not, what is the safest / cleanest way for a Windows service to shut
itself down?
Any asssistance gratefully received.
Mark