Many IIS administrators encounter situations where application pool references persist in IIS configuration even after the physical files have been deleted. This particular case involves a stubborn entry with the virtual path /Site/login.aspx that's preventing proper AppFabric configuration.
The conventional approach of recreating the application then removing it won't work here because:
1. The virtual path contains a file extension (login.aspx)
2. IIS won't let you create applications with file extensions in the path
3. The physical files no longer exist on disk
When GUI methods fail, we need to edit the IIS configuration directly. Here's how:
Method 1: Using appcmd.exe
appcmd delete app "Default Web Site/Site/login.aspx"
Method 2: Manual XML Editing
- Navigate to
%windir%\system32\inetsrv\config\applicationHost.config - Search for the problematic application path
- Remove the entire
<application>node containing your path
Example of what to look for:
<application path="/Site/login.aspx" applicationPool="YourAppPool">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\oldapp" />
</application>
To avoid similar problems:
- Always remove applications through IIS Manager before deleting files
- Consider using PowerShell for bulk operations:
Import-Module WebAdministration
Remove-WebApplication -Name "Site/login.aspx" -Site "Default Web Site"
Sometimes orphaned entries persist in the application pool itself. Check with:
appcmd list apppool "YourAppPool" /text:*
And reset if necessary:
appcmd recycle apppool "YourAppPool"
Dealing with lingering application entries in IIS application pools can be frustrating, especially when the physical files no longer exist. A common scenario involves paths containing specific pages like /Site/login.aspx which prevent normal removal procedures.
When you try to remove an application through IIS Manager, the system typically requires the application to exist physically. For cases like our /Site/login.aspx example, the inclusion of a specific page in the virtual path makes recreation impossible through the GUI.
The most reliable solution is using PowerShell to directly manipulate the IIS configuration:
Import-Module WebAdministration
$appPath = "IIS:\Sites\Default Web Site\Site\login.aspx"
if (Test-Path $appPath) {
Remove-WebApplication -Site "Default Web Site" -Name "Site/login.aspx"
Write-Host "Application removed successfully"
} else {
Write-Warning "Application path not found - attempting direct removal"
# Alternative method using appcmd
& "$env:windir\system32\inetsrv\appcmd" delete app "Default Web Site/Site/login.aspx"
}
For stubborn cases, you might need to edit the applicationHost.config directly:
- Navigate to
%windir%\system32\inetsrv\config\applicationHost.config - Search for the problematic application path
- Remove the entire
<application>node containing your path - Save the file and restart IIS (
iisreset)
After performing these steps, check the removal was successful:
Get-ChildItem IIS:\AppPools | Where-Object { $_.Applications -like "*login.aspx*" }
To avoid such scenarios in the future:
- Always remove applications through proper procedures before deleting files
- Consider using PowerShell scripts for application management
- Maintain clean documentation of your IIS configuration
When dealing with AppFabric, you might need additional cleanup:
Remove-WFInstanceStore -Name "Site/login.aspx"
Clear-ASMonitoringDatabase -Application "Site/login.aspx"