SharePoint deployment, ghosted file returns 404

ぃ、小莉子 提交于 2019-12-11 04:19:54

问题


After deploying an upgrade to a particular feature which contains ghostable page template, the page starts returning a 404 response.

In the SharePoint log, I get the following

Cannot get ghost document: Features\FeatureName\SubFolder\PageName.aspx

Unknown SPRequest error occurred. More information: 0x80070002

I am able to get the page working by going through SharePoint Designer and deleting the file, then deactivating/activating the feature on that site.

I've attempted resetting the web to its definition with no change.

I would like to have a programmatic solution, whether it be fixing something in the feature's configuration or an update program.


回答1:


I was able to work-around the problem by

  1. Adding a snip of code to the feature deactivating event to delete the file in question from SitePages.

        SPFolder sitePagesFolder = web.GetFolder("SitePages");
        foreach (SPFile file in sitePagesFolder.Files)
          if (file.Name == "pagename.aspx")
            file.Delete();
    
  2. And using a utility, go through all the affected webs, re-activating the feature in question, which causes the 'orphaned or whatever' file to be removed, replacing it with the current version's

I don't understand the inner workings of the issue completely, but it seems that when the feature is deleted/reinstalled, sometimes the associated, ghosted file is orphaned, leading to this issue.




回答2:


Is it possible that the upgrade deleted the file from the file system? cause this is the likely reason. go to the feature folder and see if the file is still there. the feature folder would be under template\features under 12/14 (depending on SP version)



来源:https://stackoverflow.com/questions/3355191/sharepoint-deployment-ghosted-file-returns-404

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!