簡體   English   中英

SharePoint Foundation 2013-未找到母版頁404

[英]SharePoint Foundation 2013 - Master Page 404 NOT FOUND

我希望這是提出問題的正確地方。 我嘗試使用sosial msdn,但似乎msdn論壇已死。 我對“母版頁”有小問題。 我已經創建了Web模板和母版頁。 當我創建新的網站集並嘗試訪問它( http://win2008r2/sites/Test )時,它引發了以下錯誤:“ 404 NOT FOUND”。

但是,當我檢查MasterPage畫廊時: http://win2008r2/sites/Test/_catalogs/masterpage/Forms/AllItems.aspx

我可以找到我的Demo.master。 當我檢查網站集功能時,可以看到我的母版頁功能處於活動狀態。 我檢查了日志,這只是我發現的內容: 提取文檔時失敗。 0x80070002

我已將“ Web模板”范圍設置為“場” ,並將“ 母版”范圍設置為“站點”

我嘗試使用Google解決問題,並且嘗試了不同的指南,但不,我無法使其正常運行。 誰能幫幫我嗎?

這是Element.xml:

<Module Name="MyMasterPage" List="116" Url="_catalogs/masterpage">
    <File Path="MyMasterPage\Demo.master" Url="Demo.master" Type="GhostableInLibrary">
    </File>
  </Module>

這是事件接收器:

public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                using (SPWeb _web = ((SPSite)properties.Feature.Parent).RootWeb)
                {
                    Uri _siteMaster = new Uri(string.Format("{0}/_catalogs/masterpage/Demo.master", _web.Url));
                    _web.MasterUrl = _siteMaster.AbsolutePath;
                    _web.CustomMasterUrl = _siteMaster.AbsolutePath;
                    _web.Update();
                }
            });
        }

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SPSite curSite = (SPSite)properties.Feature.Parent;
            SPWeb curWeb = curSite.RootWeb;
            Uri masterUri = new Uri(curWeb.Url + "/_catalogs/masterpage/v4.master");
            curWeb.MasterUrl = masterUri.AbsolutePath;
            curWeb.CustomMasterUrl = masterUri.AbsolutePath;
            curWeb.Update();
        }

如果您想看更多我的代碼來解決此問題,請隨時詢問,所以我提出了更多代碼。 ;)

謝謝Yevgeniy.Chernobrivets! 問題是我已將default.aspx命名為MySite.aspx,但無法正常工作。 當我再次創建它並保留default.aspx名稱時,它起作用了! 好了,現在我必須找到更改該default.aspx name =)的方法

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM