症狀
依賴 WPProperty 的網頁部分可能無法正常運作,並在 SharePoint 統一日誌系統 (ULS) 日誌中產生 a7wm1 事件標籤。
原因
這個問題是因為 SharePoint Server 現在要求農場在 web.config 檔案中宣告允許存取 WPProperty 的 .NET 類型。 未被列出的 .NET 類型將無法存取 WPProperty ,作為安全考量。
解決方式
若要解決這個問題,請安裝下列更新之一:
- SharePoint Server 2019 的安全性更新說明:2021 年 9 月 14 日 (KB5002018)
- SharePoint Enterprise Server 2016 的安全性更新說明:2021 年 6 月 8 日 (KB5001946)
- SharePoint Foundation 2013 的安全性更新說明:2021 年 9 月 14 日 (KB5002024)
為了讓 Web Part 如預期運作,請採取以下步驟,宣告受影響的 .NET 類型 (s) 被允許存取 web.config 檔案中的 WPProperty 。
重要
只有在確認安全後,才允許 .NET 類型存取 WPProperty 。
在 SharePoint 伺服器陣列中的各個伺服器中,打開您網頁應用程式的 web.config 檔案。
尋找 configuration/SharePoint/SafeMode 區段。
如果還沒有 AllowedWPProperties 區塊,請新增。
新增一個帶有類型與 propertyName 屬性的 AllowedWPProperty 元素,以代表應該允許存取 WPProperty 的類型。
<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="15" TotalFileDependencies="250" AllowPageLevelTrace="false">
<AllowedWPProperties>
<AllowedWPProperty type="<allowedWPPropertyTypeName>,<allowedWPPropertyAssemblyName>, <AssemblyVersion>, <AssemblyLanguageSetting>, <AssemblyPublicKey>" propertyName="<Allow WPProperty property name>"/>
</AllowedWPProperties>
</SafeMode>將此變更儲存到 web.config 檔案。
要辨識 類型 與 propertyName 屬性的正確值,請查詢 ULS 日誌中的 a7wm1 事件標籤並記錄日誌條目。 例如:
"WPProperty has been blocked for security reason. blocked AssemblyQualifiedName is "<BlockedWPPropertyTypeName>, <allowedWPPropertyAssemblyName>, <AssemblyVersion>, <AssemblyLanguageSetting>, <AssemblyPublicKey>" | blocked property name is "<blocked WPProperty name>",
要讓此類型存取 WPProperty,請將 AllowedWPPProperty 類型 屬性設為被阻擋的 AssemblyQualifiedName 的值,並將 propertyName 屬性設為被阻擋的屬性名稱值。
變更歷程記錄
下表摘要說明本主題的一些最重要變更。
| 日期 | 描述 |
|---|---|
| 2021 年 9 月 14 日 | 在「方案」部分新增了兩個更新。 |