Remove zombie websites from your IIS server

Zombie websites get created whenever the root application of a website is removed, orphaning the rest of the application content in your website.

Because IIS requires the root of the website to be an application, this effectively renders the website inaccessible:

  • It cannot serve requests
  • It does not show up in InetMgr
  • It will likely break many administrative or configuration actions
Just for reference, here is what this looks like in your applicationHost.config:

 

<site>
     <application path=”/child1″> <!– Where is the root app?
         …
    </application>
</site>

 

(Note: if you remove a parent application that is NOT the root of the site, things will still work fine – even though the child apps may be considered orphaned, they are actually not.  The only change that happens is that content at the parent application’s level becomes part of the root application)

Surprisingly, this is actually easy to end up with – just delete the root application of a website instead of deleting the website itself – e.g. by running appcmd delete app “Default Web Site/”. Then try to browse to localhost :).

There is a good article describing how to find these here: Hunting zombies: how to remove orphaned IIS web applications. However, the article does not actually tell you how to remove them, and since you cannot easily remove them from InetMgr, many users seem to be out of luck.

After trying to help a user on the IIS forums here to remove a zombie app, I decided to write a quick tool to do it.

So, here you go:

Download the tool: http://mvolo.wpengine.com/wp-content/uploads/2012/11/RemoveOrphanedSites.zip.

To run it:

> RemoveOrphanedSites.exe /site:all      <– Shows all orphaned sites ONLY, does not remove

> RemoveOrphanedSites.exe /site:all /remove     <– Removes all orphaned sites

> RemoveOrphanedSites.exe “/site:Default Web Site”     <– Checks if the specific site is orphaned

> RemoveOrphanedSites.exe   <— Displays help, how to connect to remote servers, etc

Hope this helps everyone who has this problem.

Best,

Mike

4 Comments

  1. It”s a pity you don”t have a donate button! I”d without a doubt donate to this brilliant blog! I guess for now i”ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to brand new updates and will talk about this
    site with my Facebook group. Talk soon!

  2. To remove zombie web applications you can use PowerShell: remove-webapplication

    The TechNet post shows this in a screenshot but I”ll update the post to make this more obvious.

  3. Stef, just to clarify, RemoveOrphanedSites.exe is a tool that actually finds the sites that are orphaned, and gives the opportunity to delete them.

    The powershell command may be able to remove web applications (I am not sure if it actually works with sites that do have orphanned apps), but it will not find the applications that are orphanned, which is why I actually wrote the tool.

    Best,
    Mike

  4. It is really a great and helpful piece of information… I’m glad that you shared this helpful information with us… Please keep us informed like this. Thank you for sharing. Richmond Roofing Service, 6731 Pickett Dr., Richmond, TX, 77469, US, 281-973-7855

Leave a Reply

Your email address will not be published. Required fields are marked *