Fix ERROR_NO_SUCH_SITE (0X000004E1) when IIS site goes missing
You see this when IIS can't find a site you're trying to manage. Usually a corrupt site entry or bad config. Here's how to hunt it down.
When does this error pop up?
You're in IIS Manager, trying to start, stop, or bind a site. Or you're running a script with appcmd list sites or New-WebSite. Then bam — ERROR_NO_SUCH_SITE (0X000004E1) — The specified site does not exist. The site shows in the list but you can't touch it. Or it doesn't show at all but a script still references it.
I saw this on a client's Windows Server 2019 box last month. They'd migrated sites from an old 2012 server and one of them just wouldn't come online. The site entry was in applicationHost.config but the actual folder and binding were gone. Classic.
What's causing it?
IIS stores every site definition in %windir%\system32\inetsrv\config\applicationHost.config. Each site has an ID and name. When you see 0x000004E1, one of these things went wrong:
- The site entry got corrupted or deleted from the config file
- A site ID collision — two sites sharing the same ID (IIS hates that)
- The site's root physical path points to a folder that doesn't exist anymore
- A script or scheduled task is trying to manage a site that was already removed
The error code itself is 0x4E1 (that's 1249 in decimal). It's a system error that means the object (site) isn't found in the site collection. Simple enough, but the cause isn't always obvious.
Fix it step by step
Step 1: Identify the site ID
Open IIS Manager. Look at the left panel under Sites. Find the site that's giving you trouble. Right-click it and choose Advanced Settings. Note the ID field. Or run this in PowerShell (as admin):
Get-Website | Select-Object Name, ID | Format-Table -AutoSize
Write down the ID. You'll need it.
Step 2: Check applicationHost.config for corruption
Open the config file in Notepad or VS Code (as admin):
notepad C:\Windows\System32\inetsrv\config\applicationHost.config
Search for <sites>. Under that, find the <site> element with your site's ID. It looks like:
<site name="MySite" id="5" serverAutoStart="true">
<application path="/" applicationPool="MySiteAppPool">
<virtualDirectory path="/" physicalPath="C:\websites\mysite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:mysite.local" />
</bindings>
</site>
If the entire <site> block is missing, you've got a delete-in-config scenario. If it's there but the physicalPath points to a missing folder, that's your problem.
Also check for duplicate IDs — two id="5" entries. IIS will only load the first one, and the second becomes invisible.
Step 3: Fix the site entry
If the site block is missing, you have two options:
- Option A (easy): Delete the site in IIS Manager and recreate it. That'll generate a fresh config entry.
- Option B (harder): Manually add the
<site>block back into the config. Make sure the ID doesn't clash with any existing site. Use a unique ID (like 99 if you're not sure). Save the file, then runiisresetin an admin command prompt.
If the physical path is wrong, update it to the correct folder path. Save and run iisreset.
Step 4: Verify the fix
Run this PowerShell to confirm the site now shows up properly:
Get-Website -Name "YourSiteName"
You should see the site with its ID, state, and bindings. If it still fails, go back to the config and double-check the XML is well-formed. One missing closing tag breaks the whole thing.
What if it still fails?
Three things to check:
- Check the Event Viewer — Look under Windows Logs > System for IIS-related errors (source: WAS or IIS-IISManager). They'll tell you exactly which line in the config is broken.
- Check for IIS configuration history — IIS keeps automatic backups in
%windir%\system32\inetsrv\config\history. You can copy an older version ofapplicationHost.configthat worked and restart IIS. Just make sure you pick a time before the corruption happened. - Check third-party scripts — If the site was deleted but a scheduled task or deployment script still references it by ID, that script will throw this error. Find and update those scripts to use a valid site ID.
Once you fix the config or the path, restart IIS with iisreset /noforce (avoids kicking off active connections) and the site should come back to life.
Was this solution helpful?