通过工作流管理器将 SharePoint 2013 升级到 SharePoint 2016
适用于:2013
2016
2019
Subscription Edition
SharePoint in Microsoft 365
摘要
将 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 服务器上安装最新版本的 Workflow Manager 客户端,并确保所有工作流都正常运行。
安装 SharePoint Server 2016 场,并升级所有服务应用程序和内容数据库。
在所有 SharePoint Server 2016 场服务器上,使用 Web PI 安装最新版本的工作流管理器客户端。
将工作流管理器注册到 SharePoint Server 2016
使用以下步骤将工作流管理器注册到 SharePoint Server 2016:
在 SharePoint 2013 场中,在管理中心网站上单击“ 应用程序管理 ”,然后单击“ 管理服务应用程序”,然后删除 “工作流服务应用程序代理”。
在 SharePoint Server 2016 场中,运行以下Microsoft PowerShell cmdlet,将 SharePoint 2016 与相同的工作流管理器安装配对:
Register-SPWorkflowService -SPSite <SharePoint site URL> -
WorkflowHostUri <Workflow service endpoint URL> -force
升级后可能会遇到的常见问题
问题 1:网站 URL 已更改
如果在 SharePoint 2016 中更改了网站 URL,但网站 ID 保持不变,则必须使用 SharePoint 设计器从受影响网站重新发布工作流。
问题 2:工作流在某些网站上无法启动
如果工作流未在某些网站上启动,请重新发布受影响站点中的工作流。 或者,运行 “刷新受信任的安全令牌服务元数据源 ”计时器作业。
问题 3:工作流失败并返回“无法获取应用主体权限信息”错误
请考虑以下情况:
您在服务器场中配置了 SharePoint 2013 工作流和工作流管理器。
你最近已将场中的站点连接到以前存在的工作流管理器实例。
在此方案中,连接到工作流管理器安装后创建的工作流将成功完成。 但是,在连接到工作流管理器之前创建的工作流不会完成。 相反,当他们尝试完成或保持挂起状态时,它们会卡住。 对于保持挂起状态的工作流,你会收到 HTTP 500 错误。 此外,ULS 日志中记录了以下条目: 无法获取应用主体权限信息。
原因
工作流管理器已具有运行工作流的网站的范围。 由于作用域的 ApplicationID 字段中的 SPAuthenticationRealm 值不正确,因此 SPWeb 对象上不存在与作用域的 ApplicationID 值匹配的 SPAppPrincipal 类。 因此,工作流失败并返回错误消息。
解决方案
若要解决此问题,请使用以下 PowerShell 命令注册新的 SPAppPrincipal 对象。 对 SPWeb 对象执行此操作,其 ID 与存储在工作流管理器中 SPWeb 对象的作用域中的 ApplicationID 值匹配。
#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
#If app-only permissions are used in old environment, you must use the -EnableAppOnlyPolicy parameter to pass to the cmdlet for app steps to succeed
$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
请注意: 如果应用程序主体对 SharePoint 2013 网站具有 App-Only 权限,则还需要将 -EnableAppOnlyPolicy 传递到 Set-SPAppPrincipalPermission cmdlet。
更多信息
若要获取存储在作用域中的 ApplicationID 的 SPAuthenticationRealm 值,请执行以下步骤:
运行以下 SQL 查询:
SELECT * FROM [WFResourceManagementDB].[dbo].[Scopes] WITH (NOLOCK) WHERE Description like '%<WebID>%'
其中 <WebID> 是 SPWeb 对象的 ID 的占位符。
在查询结果中,单击 SecuritySettings 列中的值,以在 SQL Server Management Studio 中的单独选项卡上打开 XML。
在 XML 文件中,找到包含 值的 ApplicationID 元素。 例如,找到以下元素:
<ApplicationId>SPWeb_object_ID@SPAuthenticationRealm</ApplicationId>`
注意
显示在 at 符号 (@) 之前的 GUID 是 SPWeb 对象的 ID,在 符号之后显示的 GUID 是 SPAuthenticationRealm 值。
或者,可以在 ULS 日志中找到 SPAuthenticationRealm 值,如以下示例日志条目:
2017/11/03 12:13:16.72 w3wp.exe (SPWFE01:0x51FC) 0x1298 SharePoint Foundation 身份验证授权 an3eg Medium 无法获取应用主体权限信息。 AppId=i:0i.t|ms.sp.ext|<SPWeb 对象 ID>@<SPAuthenticationRealm>
2017/11/03 12:13:16.72 访问 /site/teamsite/teamweb/_vti_bin/client.svc 时出现 w3wp.exe (SPWFE01:0x51FC) 0x1298 SharePoint Foundation 常规 8nca 中等应用程序错误, Error=Object reference not set to an instance of an object reference at Microsoft.SharePoint.SPAppRequestContext.EnsureTenantPermissions (SPServiceContext serviceContext, Boolean throwIfAppNotExits, Boolean allowFullReset) at Microsoft.SharePoint.SPAppRequestContext.InitCurrent (HttpContext context) Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.InitCurrentAppPrincipalToken (HttpContext 上下文) 位于 Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostAuthenticateRequestHandler (Object oSender, EventArgs ea) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () at System.Web.HttpApplication.ExecuteStep (IExecutionStep,Boolean& completedSynchronously)