Forum Moderators: open
I have read that it may be possible to configure IIS 6.0 to restart automatically according to a choice of criteria: time period, number of hits, memory status, number of .asp scripts being queued ...
The problem is How do you configure IIS 6.0 to do it?
I've searched the web to find out how, but all I find are articles saying it can be done, without explicitly saying what I have to do ...
Can anyone help?
IISRESET /RESTART /TIMEOUT:nnn /REBOOTONERROR - yes
Batch file - yes
scheduled tasks - yes
<wget (command line http interface to try accessing the IIS server - if it fails then call the IISRESET command from the .bat file)>
I'm not getting to grips with that bit ...
Can you give an example of using wget? Is it used in the batch file?
You will need to download a copy of wget, any good SE should find it for you.
The command is 'wget http://www.example.com/page.asp'
If you have a set up a test.asp page you can make it return a set value which can then be tested in the .bat file.
:: Check Connection to SQLServerDB
del testsql3.asp
C:\wget\wget.exe [example.com...]
find /C "25" testsql3.asp
IF ERRORLEVEL 1 IISRESET /RESTART /TIMEOUT:120 /REBOOTONERROR
The file testsql3.asp will return a body containing the value 25 (for reasons that elude me now - you can set up the page to return whatever you like in the body) If it fails to return 25 then for some reason the IIS Server or its DB connection is down and resetting IIS often clears the problem, so we try an IIS Reset.
There are lots of variants of testing a webserver available to you using wget. You could run the wget from your own machine and have it sound an alarm on your machine if the site goes down or have another webserver send an email to you.
I managed to watch the server screen as the batch file was called just after IIS went down.
It works on our server only up to a point though:
wget tried to download the page .... when it couln't, it tried again... again...and again - by the 7th time (and 20 minutes later), I stopped the batch file and restarted the server manually.
Is this normal? Is there a way to stop wget retyring and just giving an error?
It now works a treat, and I would recommend this to anyone who wants to have the confidence to be able to leave their desk sometimes ... without having to worry about the site being down for long periods ...
Our batch file now looks like this:
del testsql1.asp
C:\wget\wget.exe --timeout=30 --tries=1 [website.com...]
find /C "SQLServer Test Code 1" testscript.asp
IF ERRORLEVEL 1 IISRESET /RESTART /TIMEOUT:120 /REBOOTONERROR