現(xiàn)象
在事件查看器的日志中,會有以下警告信息:
對象緩存: 未配置緩存使用的超級用戶帳戶。這可能會增加緩存未命中數(shù),導(dǎo)致頁面請求使用不必要的系統(tǒng)資源。
若要配置帳戶,請使用以下命令 'stsadm -o setproperty -propertyname portalsuperuseraccount -propertyvalue account -url webappurl'。此帳戶必須是對 SharePoint 數(shù)據(jù)庫具有完全控制權(quán)限的任何帳戶,而不是應(yīng)用程序池帳戶。
附加數(shù)據(jù):
當(dāng)前默認超級用戶帳戶: SHAREPOINT\system
當(dāng)去訪問一個發(fā)布頁面時,頁面會報錯,事件查看器日志中會有以下警告:
Event code: 3005
Event message: 發(fā)生了未處理的異常。
Event time: 2012/11/13 11:52:38
Event time (UTC): 2012/11/13 3:52:38
Event ID: 497ba228589e4ff2a192bf6582f525c9
Event sequence: 310
Event occurrence: 2
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1949916159/ROOT-1-129972506606997458
Trust level: WSS_Minimal
Application Virtual Path: /
Application Path: C:\inetpub\wwwroot\wss\VirtualDirectories\80\
Machine name: SJ-MOSS-04
Process information:
Process ID: 4684
Process name: w3wp.exe
Account name: XXXX\sharepoint_admin
Exception information:
Exception type: SPException
Exception message: 此用戶不存在或不唯一。
Request information:
Request URL: http://xxxx.com/sites/informationcenter/SitePages/Home.aspx
Request path: /sites/informationcenter/SitePages/Home.aspx
User host address: 10.72.29.35
User: 0#.f|admembership|XXXX
Is authenticated: True
Authentication Type: Federation
Thread account name: XXXX\sharepoint_admin
Thread information:
Thread ID: 18
Thread account name: XXXX\sharepoint_admin
Is impersonating: False
Stack trace: 在 Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
在 Microsoft.SharePoint.Library.SPRequest.GetUserToken(String bstrUrl, String bstrLogin)
在 Microsoft.SharePoint.SPWeb.GetUserToken(String userName)
在 Microsoft.SharePoint.Publishing.CacheManager.<.ctor>b__0(SPSite newSite)
在 Microsoft.SharePoint.Publishing.CommonUtilities.<>c__DisplayClass1.<RunWithElevatedSite>b__0()
在 Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
在 Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
在 Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
在 Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
在 Microsoft.SharePoint.Publishing.CommonUtilities.RunWithElevatedSite(SPSite siteNonElev, Boolean allowUnsafeUpdates, ElevatedSiteProcessor callWithElevatedSite)
在 Microsoft.SharePoint.Publishing.CacheManager..ctor(SPSite site)
在 Microsoft.SharePoint.Publishing.CacheManager.GetManager(SPSite site, Boolean useContextSite, Boolean allowContextSiteOptimization)
在 Microsoft.SharePoint.Publishing.WebControls.CombinedBasePermissions..ctor()
在 Microsoft.SharePoint.Publishing.WebControls.ConsoleNode.CurrentPermissions()
在 Microsoft.SharePoint.Publishing.WebControls.ConsoleNode.CurrentState(Page currentPage, Boolean cacheResult)
在 Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ConsoleAction.OnPreRender(EventArgs e)
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Control.PreRenderRecursiveInternal()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
原因
所有的發(fā)布內(nèi)容會啟用緩存以提高訪問性能。
環(huán)境配置了Form和AD認證,對象緩存用戶帳戶配置不正確。
對環(huán)境進行高并發(fā)測試時誘發(fā)了此問題。
解決辦法
使用管理中心創(chuàng)建用戶帳戶
確認您擁有以下管理憑據(jù):
若要在管理中心中創(chuàng)建用戶帳戶,您必須是運行 SharePoint 管理中心網(wǎng)站的計算機上 Farm Administrators 組的成員。
在管理中心網(wǎng)站上的“應(yīng)用程序管理”部分,單擊“管理 Web 應(yīng)用程序”。
單擊想要配置的 Web 應(yīng)用程序的名稱。
在“Web 應(yīng)用程序”選項卡上的“策略”組中,單擊“用戶策略”。
在“Web 應(yīng)用程序的策略”窗口中,單擊“添加用戶”。
從“區(qū)域”列表中,選擇“所有區(qū)域”,然后單擊“下一步”。
在“用戶”框中,鍵入“門戶超級用戶”帳戶的用戶名。
單擊“檢查名稱”圖標(biāo)以確保帳戶名稱可以被應(yīng)用程序服務(wù)器上的身份驗證提供程序解析。
在“選擇權(quán)限”部分,選中“完全控制 - 擁有完全控制權(quán)限”框。
單擊“完成”。
對“門戶超級讀者”帳戶重復(fù)步驟 5 到步驟 8。
在“選擇權(quán)限”部分,選中“完全讀取 - 擁有完全只讀權(quán)限”框。
單擊“完成”。
記下“對象緩存超級讀者”和“對象緩存超級用戶”帳戶的名稱在“用戶名”列中的顯示方式。顯示的字符串會有所不同,具體取決于您是否對 Web 應(yīng)用程序使用聲明身份驗證。
使用 Windows PowerShell 向 Web 應(yīng)用程序添加用戶帳戶
確認您滿足以下最低要求:請參閱 Add-SPShellAdmin。
復(fù)制以下代碼并粘貼到文本編輯器(如記事本)中:
$wa = Get-SPWebApplication -Identity "<WebApplication>"
$wa.Properties["portalsuperuseraccount"] = "<SuperUser>"
$wa.Properties["portalsuperreaderaccount"] = "<SuperReader>"
$wa.Update()
將以下占位符替換為相應(yīng)值:
<WebApplication> 是要將帳戶添加到的 Web 應(yīng)用程序的名稱。
<SuperUser> 是要使用的“門戶超級用戶”帳戶,顯示在前面過程的步驟 14 中提到的“用戶列”字段中。
<SuperReader> 是要使用的“門戶超級讀者”帳戶,顯示在前面過程的步驟 14 中提到的“用戶列”字段中。
保存文件,將其命名為 SetUsers.ps1。
注意: |
可以使用其他文件名,但必須將 ANSI 編碼的文件保存為擴展名為 .ps1 的文本文件。 |
關(guān)閉文本編輯器。
在“開始”菜單上,單擊“所有程序”。
單擊“Microsoft SharePoint 2010 產(chǎn)品”。
單擊“SharePoint 2010 Management Shell”。
轉(zhuǎn)到保存該文件的目錄。
在 Windows PowerShell 命令提示符處,鍵入以下命令: ./SetUsers.ps1
重置 Internet Information Services (IIS)。
參考資源:
配置對象緩存用戶帳戶:http://technet.microsoft.com/zh-cn/library/ff758656.aspx