Long story short -- we have 2 webservers (IIS 6) that run a 3rd party asp.net application. Randomly (so far) they just...stop working. I have an outside check that will tell me when it stops working within a minute or so. Right now I have to get onto the machines through RDP and issue an iisreset. Which is fine until I'm not at a machine and I have to get to one PDQ.

I wrote a simple page that will issue an iisreset on the offending remote machine(s). This works, usually. Sometimes "iisrestart \machinename" will stop the IIS service, but not restart it, which is bad.

Ideally, I'd like to know if I can just stop the service, try to start it, and if it doesn't start in 10 seconds, try to start it again. But I don't know how to monitor the status of a service remotely.

Can someone point me in the right direction?

  • Please state what version of IIS you are using – Mathias R. Jessen Dec 30 '11 at 18:28
  • 6 unfortunately. I'll edit the question to reflect that as well. – Matt Dawdy Dec 30 '11 at 18:31

I think you'd be better off recycling the affected app pool on the unresponsive server: http://technet.microsoft.com/en-us/library/cc770764(WS.10).aspx

If you run IIS6, this might be interesting (in a broad sense it also applies to IIS7): http://blogs.msdn.com/b/david.wang/archive/2006/01/26/thoughts-on-application-pool-recycling-and-application-availability.aspx

But the best think you could do would probably be to troubleshoot the application, and make sure it doesn't stop working in the first place

UPDATE: Since you use IIS6, read the above article, and have a look it this: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1eee28e2-b319-4b4e-8267-a8c0aa0dcf36.mspx?mfr=true

Chris Adams made a blog post some years back with a little application to recycle IIS app pools (utilizing WMI), this might come in handy: http://blogs.iis.net/chrisad/archive/2006/08/30/Recycling-Application-Pools-using-WMI-in-IIS-6.0.aspx

  • the app is 3rd party and we are 8 versions back of their current code base. We are upgrading in March, but this issue crops up 1-2 times a day, and is a huge pain for our users if I'm not immediately where I can restart IIS. I will try the app pools next time (there are 4) and see if that makes it recover. I wish I could cause this to happen so I could test it. – Matt Dawdy Dec 30 '11 at 18:33
  • @MattDawdy Just updated the answer a little, with a few relevant links for you – Mathias R. Jessen Dec 30 '11 at 18:46

I dealt with a similar issue four or five years ago except for an in house app that was being rewritten.

If there is any kind of event raised in the event log you could set up a sink that watches for that event and issue a scripted reset via vbs / wmi.

Check out the official MS docs.

EDIT - Ugly.. If you have Nagios you could set up an event handler based on page response time that does a reset / recycle.

  • That was our first thought, but no, it just slows performance until it eventually times out all requests. The next thing we tried was to monitor the memory usage of w3wp.exe (or whatever it is called), but that didn't give us any sort of usable information either. – Matt Dawdy Dec 30 '11 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.