SharePoint Workflow Configuration Common Issues

  • Unable to connect to the remote service

PS C:\Users\mossadm> Register-SPWorkflowService  -SPSite “” -W
orkflowHostUri -AllowOAuthHttp
Register-SPWorkflowService : Unable to connect to the remote service at See InnerException for more details. Client
ActivityId : e592f590-80d3-4f43-9118-39e526e3c5ff.
At line:1 char:1
+ Register-SPWorkflowService  -SPSite “” -WorkflowHostUri
http:/ …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidData: (Microsoft.Share…WorkflowService:
RegisterSPWorkflowService) [Register-SPWorkflowService], WorkflowEndpointN
+ FullyQualifiedErrorId : Microsoft.SharePoint.WorkflowServices.PowerShell

In here ; SharePoint is telling you that it cannot find the Workflow Manager service endpoint at this address
– Check for the Firewall and possible networking issues.
– Make a browser test that you can browse the workflow host uri
-Check the WFM IIS for the bindings of the Workflow Manager Site
-Check that the workflow manager  IIS to make sure that the Workflow Manager Front End is running on correct port !.

  • When you try to publish a workflow you may face following issues.

Microsoft.SharePoint.SPException: App Management Shared Service Proxy is not installed.
at Microsoft.SharePoint.AppRegistration.GetProxy(SPServiceContext serviceContext)
at Microsoft.SharePoint.AppRegistration.AddOrUpdateAppNoPermissionCheck(SPAppPrincipalInfo appInfo)
at Microsoft.SharePoint.SPAppPrincipalManager.RegisterWithInternalDirectory(SPAppPrincipalIdentityProvider identityProvider, String nameIdentifier, String displayName, List`1 appEndpointAuthorities, List`1 redirectAddr

You can face this  because App Management Service application is not provisioned or the App Management Service is not running or the App Management Service Proxy is not added to the default proxy group.
-Check the app management service from CA -> Application Management -> Manage Service Application . If it is not provisioned , provision it.

Then if you face this ;
Microsoft.SharePoint.SPEndpointAddressNotFoundException: There are no addresses available for this application.
at Microsoft.SharePoint.SPRoundRobinServiceLoadBalancer.BeginOperation()
at Microsoft.SharePoint.Administration.SPServiceApplicationProxyBase`1.ExecuteOnChannel(Boolean requireDelegation, Action`1 codeBlock)
at Microsoft.SharePoint.AppManagement.AppManagementServiceApplicationProxy.GetScaleOutDatabaseMap()
at Microsoft.SharePoint.SPScaleOutDatabaseMap.GetMapCacheEntries

-Dont forget to start App Management Service from CA-> Services on Server -> App Management Service
Make an IISReset

  • When you try to run a SP 2013 workflow, you get a ‘suspended’ error message, and the error states;
    RequestorId: <Guid>. Details: RequestorId: <Guid>. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 401 {“error_description”:”The server was unable to process the request due to an internal error.

The reason may the security service application is unable to identify the user id from the user claim

-Open IIS Manager, navigatred to Application Pools > Click on the app pool named “Security Token Serice Application Pool”
-Click Advanced settings
-Modified the value for the property named “Load User Profile” from FALSE to TRUE
-Perform an IISRESET /noforce

Microsoft.Workflow.Client.AuthenticationException “Authentication Failed”

When attempting to publish a workflow in SharePoint 2013 . you may facing following problem.

System.InvalidOperationException: Operation failed with error Microsoft.Workflow.Client.AuthenticationException: Authentication Failed. Valid credentials must be provided for one of the following protocols: Bearer, Negotiate. HTTP headers received from the server – ActivityId: 440bd264-3528-4880-91c9-03247a2e5e10. NodeId: WFSERVER01. Scope: /SharePoint/default/e72269ca-0e8c-4bd6-800a-9499da19f233. WWW-Authenticate: Bearer realm=”22a5da47-566b-4e0b-90f9-76752903b68e”, client_id=”00000005-0000-000

TroubleShooting Steps
1) First you have to check installation and upgrades:
It is important that any Cumulative Updates (CU) for SharePoint Server 2013 and Workflow Manager are installed in a coordinated fashion. After an update has been performed, several Windows PowerShell cmdlets must be run in order to maintain the connection between the SharePoint Server 2013 farm and the Workflow Manager farm.
Check that you have Service Bus 1.1
Check that you have Workflow Manager 1.0 Refresh installed
Check that you have Workflow Manager 1.0 Refresh Client (must installed all SharePoint Servers)
Check that you have at least SharePoint 2013 SP1.
(Article Date: 24/12/2014)

If you want to use Workflows with Microsoft supportability you need to have latest bits is running.

2) Check Network connections. (Dont miss this step is very important , Even Some Scenarios it looks working while you can save workflows and Worflow Manager Service looks connected but this issue can happen)
SharePoint Servers (WFEs) must able to reach Workflow Manager web site
And also it is a requirement that from Worflow Manager Machine (if it is a different machine) must able to browse the site url which you use to register-spworkflowservice.
Ping both machines that have ip communication
And also Check Proxies

3) Check all host file entries on every server that is there something preventing network communication .

4) Check Firewall rules and communications.

5) Test your credentials are correct or not .

7) Check Workflow Services are running , Workflow Manager Web Site is up and Application pool is alive.

8) If workflow manager is hosted on a different machine check IIS configuration that you have Windows Authentication is enabled.

9) Try re-register workflow service by scopename;
Register-SPWorkflowService -SPSite ‘http://mywebsite&#8217; -WorkflowHostUri ‘https://workflowhost&#8217; -AllowOAuthHttp -scopename “SharePoint”  -Force

10) If it doesnt work ; unregister the Workflow manager from the sharepoint farm
Get-SPWorkflowServiceApplicationProxy | Remove-SPServiceApplicationProxy
and run
Register-SPWorkflowService -SPSite ‘http://mywebsite&#8217; -WorkflowHostUri ‘https://workflowhost&#8217; -AllowOAuthHttp -scopename “SharePoint”  -Force
this will recreate the SPWorkflowServiceApplication Proxy.

(Dont Forget make an iisreset after use “Register-SPWorkflowService”)

11) Verify you have using latest activities are updated through the Workflow Manager.

$credential = [System.Net.CredentialCache]::DefaultNetworkCredentials
$site = Get-SPSite(<siteUri>)
$proxy = Get-SPWorkflowServiceApplicationProxy
$svcAddress = $proxy.GetWorkflowServiceAddress($site)
Copy-SPActivitiesToWorkflowService -WorkflowServiceAddress $svcAddress -Credential $credential -Force $true

Make your test with creating a new workflow and publish.




SharePoint 2013 Workflows – High Availability (MSMQ)

Workflow Manager only supports a farm with 1 computer or a farm with 3 computers.

There is a very good article by  that you can read details .
“However this isn’t high availability, its horizontal scalability. It’s pretty sweet. The trouble is the perception that “Service Bus takes care of everything”. Which is not the Case…

When we create a connection to a Workflow Manager farm from a SharePoint farm with the Register-SPWorkflowService cmdlet we pass in a WorkflowHostUri parameter. This typically is the host name of a Workflow Manager host. If we have three Workflow Manager hosts, which host name should we use? Well we can use anyone we like, as long as it’s valid. This will work. But it’s not highly available. If that particular host is down for whatever reason, our Workflow Connection – which is a Service Application Proxy – will be broken and we cannot configure or execute any SharePoint 2013 workflows.”

The servers should be configured with a software or hardware load balancer for proper load balancing, or can be accessed directly”
Load Balancing is a solution for this issue but it is not enough .
As again

“A load balancer generally does load balancing. Whether it’s NLB or ARR or an “intelligent”, “hardware” device from the usual suspects, it doesn’t make any difference. They all require configuration and scripting to truly function for HA. If all you need is a solution for when you reboot a host due to Windows Updates or similar scenarios you are good. But for everything else you need to tell the load balancer how to be “intelligent”, it will not happen out of the box.”

there is also one more resolution for high availability : MSMQ.
MSMQ is a Windows Server feature that you can enable on your SharePoint Server computer to allow asynchronous event messaging in SharePoint workflows. To support asynchronous event messaging, you must enable MSMQ on your SharePoint Server computer.

After MSMQ installed it can be easily activate by powershell:

$proxy = Get-SPWorkflowServiceApplicationProxy
$proxy.AllowQueue = $true;

MSMQ provides Queue functionality  for SharePoint side , like Service Bus does  for Workflow Manager side. If we summarize
For High Availability:

1) Scale up your Workflow Manager Farm by 3 server.
2) Configure Workflow Manager host uri for your LB and DNS as correctly
3) And Use MSMQ !!! which is not OOB enabled for SharePoint 2013 servers.





How to debug SharePoint 2013 workflows by Visual Studio

Normally you can debug SharePoint 2013 workflows that developed by Visual Studio  via using F5 and putting breakpoints . In this scenario actually the debugging happens with a Service Host emulator not actual Workflow Manager host instance. In some cases the actual activities or components are not same as registered by SharePoint to Workflow Manager according to Service Host emulator. As a consequence of this , the breakpoints can not hit when execution . .To fix that issue you have to be sure that your dev tools and components are same the host environment.

Workflow debugging also supports using Visual Studio’s infrastructure to attach to a process. This enables the workflow author to debug a workflow running in a different host environment such as Internet Information Services or actual Workflow Service’s Host. If your workflow manager is already setup in same box with your Visual Studio , here you can find how can you do it.

1) Open your workflow Project in Visual Studio .

2) Set the breakpoint for related activity .



3) Click Visual Studio -> Tools -> Attach to Process


4) Find and select “Microsoft.Workflow.ServiceHost.exe” in process list .

5) Click the “Select…” button for code type


6) Select “Debug these code types” as Workflow and click OK .

7) Click “Attach” Button and Attach one more time for the confirmation window.

8) After that you have to lunch/run related workflow from SharePoint Site.

9) If everything is correct , the breakpoint will get hit.


As you can see the callstack and local parameters are shown and can be debugable.




Content Type Publishing does not publish SPD reusable workflow along with Content Type for SharePoint 2010

Content type Publishing will include workflow associations, but not the workflow themselves. It is by design , In SharePoint 2010, Content Type Publishing will include the workflow association, however the actual workflow is not published. To work around this behavior, workflows should be manually created or transferred to the site before the Content Type and workflow association are published.

SharePoint 2013 Workflows are not working issue

If you are facing following symptoms and your workflows are not working ;

01/17/2014 16:29:17.11 w3wp.exe (0x1740) 0x1500 SharePoint Foundation Authentication Authorization ajmmu Medium Permission check failed. asking for 0x10000, have 0x2000000000
01/17/2014 16:29:17.11 w3wp.exe (0x1740) 0x1500 SharePoint Foundation CSOM afxwb High System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.     at
permissionMask)     at Microsoft.SharePoint.Client.SPClientServiceHost.OnBeginRequest()

01/17/2014 16:29:17.13 w3wp.exe (0x210C) 0x2648 SharePoint Portal Server UserProfiles ae0sx Unexpected
Error trying to search in the UPA. The exception message is ‘Microsoft.Office.Server.UserProfiles.UserProfileApplicationNotAvailableException:
UserProfileApplicationNotAvailableException_Logging ::UserProfileApplicationProxy.ApplicationProperties

RequestorId: 688a2648-fa2d-617b-b6ef-c5059d97480d. Details: System.ApplicationException: HTTP 401 {“error_description”:”The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.”} {“x-ms-diagnostics”:[“3001000;reason=\”There has been an error authenticating the request.\”;category=\”invalid_client\””],”SPRequestGuid”:[“688a2648-fa2d-617b-b6ef-c5059d97480d”],”request-id”:[“688a2648-fa2d-617b-b6ef-c5059d97480d”],”X-FRAME-OPTIONS”:[“SAMEORIGIN”],”SPRequestDuration”:[“18″],”SPIisLatency”:[“2″],”Cache-Control”:[“private”],”WWW-Authenticate”:[“Bearer realm=\”ada7f9dd-5619-496c-9ad2-03bec5bb978e\”,client_id=\”00000003-0000-0ff1-ce00-000000000000\”,trusted_issuers=\”00000005-0000-0000-c000-000000000000@*,00000003-0000-0ff1-ce00-000000000000@ada7f9dd-5619-496c-9ad2-03bec5bb978e\””,”NTLM”],”X-AspNet-Version”:[“4.0.30319″],”X-Powered-By”:[“ASP.NET”],”X-Content-Type-Options”:[“nosniff”],”X-MS-InvokeApp”:[“1; RequireReadOnly”],”MicrosoftSharePointTeamServices”:[“″],”Date”:[“Fri, 17 Jan 2014 16:04:05 GMT”]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Check for your

TroubleShooting Steps:
1) Check that your SharePoint 2013 has latest CU has installed.
2) Check that Workflow Manager and Service Bus features has latest patches.
3) User Profile Service Proxy is up and running and the related Web Application has connected this service Proxy .

You can reset Proxy connection as below:
CA-> Application Management -> Manage Web Application
Select related your web application
Click Service Connections on the ribbon
Deselect/ Reselect UPA Proxy service connections.

4) Check and define all your Web Application’s Application pool , STS Service Application pool , UPA Service Application identities.

5) Open CentralAdministration -> Application Management -> Manage Service Application
6) Select User Profile Service Application
7) Click the Permissios button on the ribbon
8) Add if any missing account belong to Web Application’s ,STS Service’s or UPA Service Applications’s pool identities with Full Control.

9) Open Central Administration -> Services on Server
10) Restart
*User Profile Service
*User Profile Syncronization Service .