SharePoint 404 Error (After restoring a previous copy of a content database to replace the current one)
A 404 error in SharePoint can mean multiple things. In this case, it happens because we restored an older version of a content database to resolve an issue. Now when we go to the site we get a 404 (even after an iisreset).
Basically we will want to clear the local SharePoint config cache on all of the front end servers. There is a cache.ini file and several xml files generated by SharePoint. We will be resetting the cache.ini file to 1 and deleting all of the XMLfiles. SharePoint will then start rebuilding.
The first step will be to stop SharePoint timer service. This will prevent SharePoint from rebuilding the cache before we have a chance to delete all of the XML files. If you are fast enough this is not necessary, but it is a good idea to perform this step.
Next we need to navigation to “c:\PogramData\Microsoft\SahrePoint\Config”. Make sure you can see hidden directories and file extensions to make things easier.
Now we need to find the right directory. Because these are generated by SharePoint, they will not have the same names every time. We can tell if it is the right directory if it has a cache.ini file and several XML files (in some cases several thousand or more).
Now open the cache.ini file in notepad
Select all of the XML files and delete them.
Set the cache.ini file to 1 and save it.
Now we can start the SharePoint Timer Service back up. You will see the directory begin to fill back up with XML files. Do the same for the other frontends, and you should be able to see the site without the 404 error.
A TechNet blog has a great PowerShell script that can be used instead of the manual method (http://blogs.technet.com/b/sp/archive/2013/05/29/clear-sharepoint-config-cache-with-powershell.aspx):
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue
$folders = Get-ChildItem C:\ProgramData\Microsoft\SharePoint\Config
foreach ($folder in $folders)
$items = Get-ChildItem $folder.FullName -Recurse
foreach ($item in $items)
if ($item.Name.ToLower() -eq “cache.ini”)
$cachefolder = $folder.FullName
$cachefolderitems = Get-ChildItem $cachefolder -Recurse
foreach ($cachefolderitem in $cachefolderitems)
if ($cachefolderitem -like “*.xml”)
}}$a = Get-Content $cachefolder\cache.ini
$a = 1
Set-Content $a -Path $cachefolder\cache.ini
read-host “Do this on all your SharePoint Servers – and THEN press ENTER”
If you’ve determined that you need to delete your site, but can’t use the usual methods, see Part 2 on how to delete that site collection.