Monday, January 7, 2013

HTTP Error 503. The Service is unavailable.


This error reads:
Service Unavailable - HTTP Error 503. The service is unavailable.

I'd like to open up by saying what we are all thinking when this happens, "YEAH NO SHIT!" Okay, now that I got that out of the way on to the possible solution to this annoying problem. I'd like to add that I have seen this happen for any variety of reasons. I guess I can generalize the cause and say it is server trauma. Any major changes can cause something like this to happen. For example if you did a bare metal backup and restore of your server, this can happen.

A Possible Solution
I can't guarantee that this will fix your problem, but it is worth a shot right? When this happens first thing you want to do is add a simple file to your application's directory. 
  1. Create a file named "Test.htm"
  2. Edit the file to contain the word "hi" or add your name or phone number. The point is add something you can identify uniquely. 
  3. Browse to this file. Do so from the content view of your application in IIS7 right click the Test.htm file and select Browse from the context menu. 
This exercise tells us a few things. First it let's us know if IIS is responding at all, if you just get the same Error, then chances are it isn't your application. You can check the event viewer, but again chances are nothing will show up in there. Lastly check your application pool, if your application pool is stopped, then there is a problem with your application pool. You can try to tinker with it, or just blow it away and re-create it.

Before Deleting Your Application Pool
I strongly recommend taking screenshots of your application pool's configuration before removing it and trying to re-create it. Specifically you want to open up it's advanced settings and screen shot the entire window. Open up any collapsed regions and screen shot those too just in case.

Application Pool Identity Gotcha
Make absolutely sure to note which application pool identity you are using, especially if it is a custom account! Meaning, it is not the default identity, network, system etc... Meaning you are using a custom windows account as the identity that requires a specific domain, username and password. Make absolutely sure you have that information before deleting your application pool otherwise you might regret blowing it away early.

Basic Steps
  1. Move all dependent applications from the damaged application pool to a temporary application pool. If you don't do this you can't delete the damaged application pool. Create a dummy application pool if necessary, the settings don't matter until you are creating your new application pool.
  2. Screenshot all of the application pool's advanced settings, including any collapsed regions.
  3. Delete the offending application pool
  4. Create a new replacement application pool and name it what it was named before (you can change the name if you want, but for the sake of consistency, I would name it the same thing)
  5. Update the new application pool's advanced settings
  6. Move all of the dependent applications from the temporary application pool back to the replacement application pool.
  7. Try to access the file we created initially named "Test.htm", if that works try to access your application.
  8. Rejoice and get back to work. If that didn't work for you, then it is back to google for you :'(
Hope this helps anyone.

No comments:

Post a Comment