通过工作流管理器将 SharePoint 2013 升级到 SharePoint 2016

原始 KB 编号: 4073758

摘要

将 Microsoft SharePoint 2013 升级到 Microsoft SharePoint 2016 时,无需创建新的工作流管理器安装。 可以使用新 SharePoint 2016 场中 SharePoint 2013 场使用的相同安装。

但是,在某些情况下,可能需要创建工作流管理器的新安装。 例如,如果要将工作流管理器移动到其他 Windows 操作系统,或者后端数据库服务器已解除授权。 在这些情况下,请按照 工作流管理器 灾难恢复中的步骤使用旧数据库创建新的工作流管理器安装。 请确保使用工作流管理器数据库的最新副本。

背景

将 SharePoint Server 与 工作流管理器 一起使用时,工作流管理器保留已发布工作流的 SharePoint 网站的记录。 每个站点在 工作流管理器 中表示为范围。 工作流管理器还存储工作流定义、所有工作流实例及其状态。

SharePoint 存储 SharePoint 工作流的工作流历史记录和工作流任务信息。 加载工作流状态页时,SharePoint 首先调用 工作流管理器 以查看工作流是否存在。 为此,它使用工作流实例 ID。 然后,SharePoint 加载其余工作流信息。 如果在工作流管理器中缺少工作流实例 ID,或者如果在与工作流管理器通信期间发生错误,则会收到错误消息。

通过工作流管理器将 SharePoint 2013 升级到 SharePoint 2016

先决条件

  • 使用 Web 平台安装程序 (Web PI) 安装工作流管理器的最新累积更新。
  • 在 SharePoint 2013 服务器上安装最新版本的 工作流管理器 客户端,并确保所有工作流均正常运行。
  • 安装 SharePoint 2016 场,并升级所有服务应用程序和内容数据库。
  • 在所有 SharePoint 2016 场服务器上,使用 Web PI 安装最新版本的 工作流管理器 客户端。

向 SharePoint 2016 注册工作流管理器

为此,请按照下列步骤操作:

  1. 在 SharePoint 2013 场中,转到“中心管理员>应用程序管理>管理服务应用程序”,然后删除工作流服务应用程序代理

  2. 在 SharePoint 2016 场中,运行以下 PowerShell cmdlet 以将 SharePoint 2016 与相同的工作流管理器安装配对:

    Register-SPWorkflowService -SPSite <SharePoint site URL> -WorkflowHostUri <Workflow service endpoint URL> -force
    

注意

请注意,新 SharePoint 2016 场中升级的内容数据库应已从最新备份还原。 这有助于防止工作流管理器与内容数据库之间的差异和差距。

升级后可能会遇到的常见问题

问题 1:网站 URL 已更改

如果在 SharePoint 2016 中更改了网站 URL,但网站 ID 保持不变,则必须使用 SharePoint Designer从受影响的网站重新发布工作流。

问题 2:工作流在某些网站上无法启动

如果工作流未在某些网站上启动,请重新发布受影响站点中的工作流。 或者,运行 “刷新受信任的安全令牌服务元数据源 ”计时器作业。

问题 3:工作流失败并返回“无法获取应用主体权限信息”错误

症状

请考虑以下情况:

  • 你有 SharePoint 2013 工作流,并在服务器场中配置了工作流管理器。
  • 你最近已将场中的站点连接到以前存在的 工作流管理器 实例。

在此方案中,连接到 工作流管理器 安装后创建的工作流将成功完成。 但是,在连接到工作流管理器之前创建的工作流不会完成。 相反,当他们尝试完成或保持挂起状态时,它们会卡住。 对于保持挂起状态的工作流,你会收到 HTTP 500 错误。 此外,ULS 日志中记录了以下条目:

无法获取应用主体权限信息。

原因

工作流管理器已具有运行工作流的网站的范围。 由于作用域的 ApplicationID 字段中的值不正确SPAuthenticationRealm,因此 SPWeb 对象上不存在SPAppPrincipal与范围值匹配ApplicationID的类。 因此,工作流会失败并返回错误消息。

解决方案

若要解决此问题,请使用以下 PowerShell 命令注册新 SPAppPrincipal 对象。 在对象的 ID 与存储在 工作流管理器 对象作用域SPWeb中的值匹配ApplicationID的对象上SPWeb执行此操作。

#Variables
$webUrl = "http://sp.contoso.com/sites/teamsite/teamweb"
$oldAuthRealm = "58a2b173-0f88-4bff-935b-bf3778cd0524" #authentication realm expected by Workflow Manager
$newAuthRealm = "48834d17-d729-471e-b0d0-a0ec83b49de0" #authentication realm of current farm

#Get the SPWeb and SPSite objects, and the id of the web
$web = Get-SPWeb $webUrl
$site = $web.site
$clientId = $web.Id

#Create the old and new app principal ids
$oldAppId = "$clientId@$oldAuthRealm"
$newAppId = "$clientId@$newAuthRealm"

#Register the app principal with the old authentication realm
Register-SPAppPrincipal -DisplayName "Old Workflow" -Site $web -NameIdentifier $oldAppId

#Set permissions for the app principal
$oldAppPrincipal = Get-SPAppPrincipal -Site $web -NameIdentifier $oldAppId
Set-SPAppPrincipalPermission -Site $web -AppPrincipal $oldAppPrincipal -Scope SiteCollection -Right FullControl
Set-SPAppPrincipalPermission -Site $web -AppPrincipal $oldAppPrincipal -Scope Site -Right FullControl

#List the app principals with the old and new authentication realms in the ids
Get-SPAppPrincipal -Site $web -NameIdentifier $oldAppId | fl
Get-SPAppPrincipal -Site $web -NameIdentifier $newAppId | fl

详细信息

若要获取存储在 SPAuthenticationRealm 作用域中的 的值 ApplicationID ,请执行以下步骤:

  1. 运行以下 SQL 查询:

    SELECT *
    FROM [WFResourceManagementDB].[dbo].[Scopes] WITH (NOLOCK)
    WHERE Description like '%<WebID>%'
    

    注意

    <WebID> 是对象的 ID 的 SPWeb 占位符。

  2. 在查询结果中,单击列中的值SecuritySettings以在 SQL Server Management Studio 中打开单独选项卡上的 XML。

  3. 在 XML 文件中,找到 ApplicationID 包含 值的元素。 例如,找到以下元素:

    <ApplicationId>SPWeb_object_ID@SPAuthenticationRealm</ApplicationId>

    注意

    出现在 at 符号 (@) 之前的 GUID 是对象的 ID SPWeb ,在 符号之后显示的 GUID 是 SPAuthenticationRealm 值。

或者,可以在 ULS 日志中找到 SPAuthenticationRealm 值,如以下示例日志条目:

日期/时间 w3wp.exe (SPWFE01:0x51FC) 0x1298 SharePoint Foundation 身份验证授权 an3eg Medium 无法获取应用主体权限信息。 AppId=i:0i.t|ms.sp.ext|<SPWeb 对象 ID>@<SPAuthenticationRealm>

访问 /site/teamsite/teamweb/_vti_bin/client.svc 时出现日期/时间 w3wp.exe (SPWFE01:0x51FC) 0x1298 SharePoint Foundation 常规 8nca 中等应用程序错误,错误=对象引用未设置为对象的实例。 at Microsoft.SharePoint.SPAppRequestContext.EnsureTenantPermissions (SPServiceContext serviceContext, Boolean throwIfAppNotExits, Microsoft.SharePoint.SPAppRequestContext.InitCurrent (HttpContext 上下文) microsoft.SharePoint.ApplicationRuntime.SPRequestModule.In 处的 boolean allowFullReset) microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostAuthenticateRequestHandler (Object oSender 的 HttpContext 上下文) (HttpContext 上下文 (EventArgs ea) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () at System.Web.HttpApplication.ExecuteStep (IExecutionStep,Boolean& completedSynchronously)