36

I have an application in one of my application pools that has a virtual path of '/Site/login.aspx'. I want to remove it but it no longer exists on my computer and it's causing me issues setting up AppFabric.

I understand that you can remove these phantom applications by recreating the application in IIS and then hitting Remove. That will get rid of the application from the pool but in this case I can't recreate the application due to the /login.aspx in the virtual path

Any ideas how I remove this erroneous entry?

Thanks

42

Since I had the same issue; application pools with applications that did not exist anymore, I did some research and finally managed to solve the issue.

Here are some steps:

  1. Locate and edit your IIS 7 configuration file "applicationHost.config" with a text editor. It should be stored in "C:\windows\system32\inetsrv\config" Since the folder is somehow "protected", I usually edit like the following:
    1. Open Windows Explorer
    2. Navigate to "C:\windows\system32\inetsrv\config"
    3. Copy the file "applicationHost.config"
    4. Paste it to a folder where you can edit it, e.g. your Desktop
    5. Open it with your editor of choise and edit it
    6. Copy it back with Windows Explorer to "C:\windows\system32\inetsrv\config"
  2. Make a backup of your "applicationHost.config" file!
  3. Search with a text editor in your "applicationHost.config" for your non-existing applications. They should be located somewhere inside an <application ...> XML node.
  4. Delete the <application ...> node(s) of all your phantom applications.
  5. Save the file and copy it back to "C:\windows\system32\inetsrv\config"
  6. Refresh the IIS management console. Your application pools should now be without the phantom applications you previously deleted.
  7. Actually remove the now empty application pool.

That worked for me, if it does not work for you, please post a comment here. A good help was this posting on the IIS forum.

2

This is probably safer and simpler than editing applicationHost.config.

Powershell  
PS C:\Windows\system32> import-module WebAdministration
PS C:\Windows\system32> iis:
PS IIS:\> cd .\AppPools
PS IIS:\AppPools> ls
PS IIS:\AppPools> del [name of phantom AppPool]  
1

Much more simple:

  1. View stale application X and remember the (old) path Y
  2. Create the (old) path / folder Y with Explorer
  3. Refresh IIS Management Console
  4. You will find the just created folder Y and assigned application X
  5. Right click on (old) application X and choose "Remove"
  6. Remove path Y with Explorer
  7. Refresh IIS Management Console again
  8. Hurray
1

Child applications aren't automatically deleted and the IIS Manager can't display them in the tree, so that's your problem...

A quick and robust way is to use a PowerShell script to get all applications, test whether the physical path still exists and if not, delete the application:

# This is for IIS 7, make sure the snap-in is installed first: https://www.iis.net/downloads/microsoft/powershell
Add-PSSnapin WebAdministration

# Get all IIS sites
Get-ChildItem IIS:\Sites | foreach {
    $site = $_;

    # Get all applications without existing physical path
    $applications = Get-ChildItem $site.PsPath | Where-Object { $_.NodeType -eq "application" -and (Test-Path $_.PhysicalPath) -eq $False };

    # List all phantom applications
    $applications | FT

    # Remove applications
    $applications | Remove-WebApplication -Site $site.Name
}
  • Just a little correction: IIS Manager can display the phantom applications by selecting the 'Application pools' or 'Sites' node and selecting 'View Applications' on a appPool/site. It only allows deleting from the 'Sites' node though! – Ronald Jan 4 '18 at 10:50
  • This worked perfectly for me, although I had to change "Add-PSSnapIn" to "Import-Module" on Server 2012 R2. – Logan Jul 17 '18 at 13:43
1

There is an easy way to fix this.

  1. Select the site with the Phantom applications in the application pool.
  2. On the right side "Action" menu select "View Applications". This list should show all the applications that is in the site, Phantom or not.
  3. All you need to do is select the Application and select "Remove" in the right "Action" menu.
0

Why not edit MetaBase.xml directly? Of course, back it up before that.

Or create a "temp" pool, move all other apps there, remove the orig pool, and rename (if needed) the new pool.

  • 4
    First reason: Because it's IIS7, so editing ApplicationHost.config is required! But I agree, I'm not understanding why it's not just "plonk that URL in a different App Pool first"? – TristanK Jun 23 '11 at 21:55
  • 2
    Thanks for the help. I had moved the URL into a temp pool first and that does remove the problem with AppFabric. However, I still cannot see how I can remove the dodgy application as you cannot delete an app pool as long as it has applications using it, and I can't delete the application from the application pool – Col Jun 24 '11 at 8:14
0

I did a combination of two answers listed above since I did not want to tinker applicationHost.config manually.

Step 1 - Create a temporary app pool - let's say "temp".

Step 2 - Move all the phantom applications to this temp app pool.

Step 3 - Use Powershell from one of the answers above -

Powershell  
PS C:\Windows\system32> import-module WebAdministration
PS C:\Windows\system32> iis:
PS IIS:\> cd .\AppPools
PS IIS:\AppPools> ls
PS IIS:\AppPools> del [name of phantom AppPool]  

Voila!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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