症状
依赖 WPProperty 的 Web 部件无法再正常工作,并在 SharePoint 统一日志记录系统 (ULS) 中生成 a7wm1 事件标记。
原因
发生此问题的原因是 SharePoint Server 现在要求服务器场声明允许访问 web.config 文件中的 WPProperty 的 .NET 类型。 作为安全预防措施,未列出的 .NET 类型无法访问 WPProperty。
解决方法
若要解决此问题,请安装下列任一更新:
-
SharePoint Enterprise Server 2016 安全更新说明:2021 年 6 月 8 日 (KB5001946)
-
SharePoint Foundation 2013 安全更新说明:2021 年 9 月 14 日 (KB5002024)
若要使 Web 部件按预期工作,请执行以下步骤,声明允许受影响的 .NET 类型访问 web.config 文件中的 WPProperty。
重要: 仅当确认安全后,方可允许 .NET 类型访问 WPProperty。
-
打开 SharePoint 服务器场中每个服务器上 Web 应用程序的 web.config 文件。
-
找到 configuration/SharePoint/SafeMode 部分。
-
添加 AllowedWPProperties 部分(如果不存在)。
-
添加具有 type 和 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 文件。
若要识别 type 和 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 type 属性设置为阻止的 AssemblyQualifiedName 值,将 propertyName 属性设置为阻止的属性名称值。
更改历史记录
下表汇总了本主题的一些最重要的更改。
日期 |
说明 |
---|---|
2021 年 9 月 14 日 |
在“解决方法”部分添加了两个更新。 |