Friday, March 8, 2019

The problem

We are using SharePoint 2013 in our on-premises farm. A week ago we introduced a new feature to one of our WSP solutions, which required us to undeploy and redeploy the solution. After the deployment, many of our sites (migrated from SP 2010) stopped working - whenever our customers would access the default.aspx page (the welcome page for some sites), they would be redirected to the "Page Not Found" page.

The solution

The ULS logs showed the following lines:

Relying on fallback logic in VghostPageManager::getGhostDocument() for document: 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\SiteTemplates\STS_SENS\default.aspx'
Relying on fallback logic in VghostPageManager::getGhostDocument() for document: 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\SiteTemplates\STS_SENS\default.aspx'
Cannot complete this action.  Please try again.
Failed to get document content data. Microsoft.SharePoint.SPException: Cannot complete this action.  Please try again. ---> System.Runtime.InteropServices.COMException: Cannot complete this action.  Please try again.    

 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetGhostedFileContent(  

As you can see, the search for the ghosted default.aspx page is in the 12 and 14 hives, whereas we are using the 15 hive. Thus, the ghosted default.aspx page cannot be loaded.

Therefore, the solution that caused the discord needs to be undeployed and redeployed again, this time with the -CompabilityLevel:{14,15} clause. This will ensure that the old migrated sites, whose default.aspx page expects the compatibility level of 14, can be accomodated. We ran Install-SPSolution with this clause and everything now works great again. Nota bene - the compatibility level clause only applies to Install-SPSolution, not Upgrade-SPSolution.