依赖 WPProperty 的 Web 部件在 SharePoint 中无法再正常工作 (KB5003528)

应用对象
SharePoint Server 2016 SharePoint Server 2019 SharePoint Foundation 2013 SP1

症状

依赖于 WPProperty 的 Web 部件可能无法再正常工作,并在 SharePoint 统一日志记录系统中生成 7wm1 事件标记, (ULS) 日志。

原因

出现此问题是因为 SharePoint 服务器 现在要求场声明允许访问 web.config 文件中 WPProperty 的 .NET 类型。 未列出的 .NET 类型无权访问 WPProperty 作为安全预防措施。

解决方法

若要解决此问题,请安装下列任一更新:

若要使 Web 部件按预期工作,请执行以下步骤,将受影响的 .NET 类型 () 声明为允许访问 web.config 文件中 的 WPProperty

重要

仅允许 .NET 类型在确认可安全访问 WPProperty 之后访问。

  1. 打开 SharePoint 服务器场中每个服务器上 Web 应用程序的 web.config 文件。

  2. 找到 configuration/SharePoint/SafeMode 部分。

  3. 添加 AllowedWPProperties 节(如果尚不存在)。

  4. 添加具有 typepropertyName 属性的新 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>

  5. 将更改保存到 web.config 文件。

若要标识 typepropertyName 属性的正确值,请在 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 日 在“解决方法”部分添加了两个更新。