SharePoint部署,幻影文件返回404 [英] SharePoint deployment, ghosted file returns 404
问题描述
在部署到包含可复制页面模板的特定功能的升级后,页面开始返回404响应.
After deploying an upgrade to a particular feature which contains ghostable page template, the page starts returning a 404 response.
在SharePoint日志中,我得到以下信息
In the SharePoint log, I get the following
无法获取幻像文档:Features \ FeatureName \ SubFolder \ PageName.aspx
Cannot get ghost document: Features\FeatureName\SubFolder\PageName.aspx
发生未知的SPRequest错误.详细信息:0x80070002
Unknown SPRequest error occurred. More information: 0x80070002
通过浏览SharePoint设计器并删除文件,然后在该站点上停用/激活功能,可以使页面正常工作.
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.
推荐答案
我能够通过
-
向功能停用事件中添加代码段,以从SitePages中删除相关文件.
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();
并使用实用程序,遍历所有受影响的网站,重新激活有问题的功能,这将导致删除孤立的文件或任何文件",将其替换为当前版本的
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.
这篇关于SharePoint部署,幻影文件返回404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!