Connect SharePoint 2013 to the workflow platform

Workflow in SharePoint 2013

SharePoint 2013 comes with a brand new workflow ecosystem based upon the capabilities of the .NET Framework 4.5 and Windows Azure. The two key components for hosting workflows are the Workflow Manager 1.0 which “provides the capability to host workflows in a high scale, high density, and multi-tenant environment” and the Service Bus 1.0 which “is a set of installable components that provides the messaging capabilities of the Windows Azure Service Bus on Windows”. For development and testing purposes, installing these on the SharePoint box works quit fine. But in the real world you probably would want to install this on one or more dedicated servers. There’s a lot of guidance available on how to install and configure these components

When you have installed them, head over to your SharePoint box to connect your farm to it:

Register-SPWorkflowService -SPSite https://sitecollectionurl -WorkflowHostUri https://workflowserver:port

If you allowed HTTP OAuth traffic when setting up your workflow server, append “-AllowOAuthHttp” to the line above. By default and in production you should use HTTPS (SSL). Also be sure to include the right port (typically 12291 for HTTP and 12290 for HTTPS).

If you try to run the Register-SPWorkflowService on a SharePoint server, you may be greeted with the following error message:

Register-SPWorkflow : Could not load file or assembly ‘Microsoft.Workflow.Client, Version=, Culture=neutral,PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

In that case, you have to install the “Workflow Client 1.0” on the SharePoint server to resolve this. This can be done via the Web Platform Installer.

Installing the Workflow Client on SharePoint 2013

Unfortunately the “Workflow Client 1.0” is not included in the prerequisites when installing SharePoint. If your SharePoint box has an internet connection, you can download the Web Platform Installer and do it from there – just search for “workflow client”. Just be sure not to install the Beta version.

Web Platform Installer

But wait, what if you don’t have an internet connection?

In that case, you have to install the Web Platform Installer (WebPI) on another server and create an installation package for the Workflow Client yourself.

Open a command prompt and navigate to the folder where you installed the WebPI. Issue the following command:

WebpiCmd.exe /offline /products:WorkflowClient /Path:<path>\OfflineCache

This may take a while and will download all necessary files to the OfflineCache folder:

Web Platform Installer

Copy this OfflineCache folder to the target server. Open a command prompt, navigate to the bin folder inside OfflineCache and run:

WebpiCmd.exe /install /products:WorkflowClient /xml:file://<path>/OfflineCache/feeds/latest/webproductlist.xml

Next accept the license agreement and you’re done!

Web Platform Installer

Now run the Register-SPWorkflowService again and you should be golden.

Of course, you can use the same trick to get the Workflow Manager and Service Bus onto the actual workflow server. In that case, use the following syntax to download them too:

WebpiCmd.exe /offline /products:WorkflowManager /Path:<path>OfflineCache

Install the bits by using

WebpiCmd.exe /install /products:WorkflowManager /xml:file://<path>/OfflineCache/feeds/latest/webproductlist.xml