Failed to query the OAuth S2S metadata endpoint

URI SP2013 register workflow service error

Couple of day ago, I setup new SharePoint 2013 UAT Farm for our new application testing. The application also contains several SharePoint 2013 workflows build in visual studio 2012.

For that reason I had to configure workflow server and connect it to SharePoint 2013 farm by using Register-SPWorkflowService command.

I tried to register Workflow Service in SharePoint 2013 Farm using below command.

Register-SPWorkflowService –SPSite ""  –WorkflowHostUri  "http://test-wfserver-01:12291/"
I received the following Error message in SharePoint management shell window.

PS C:\Users\ebloginadmin> Register-SPWorkflowService -SPSite " " -WorkflowHostUri "http://test-wfserver-01:12291/"

Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint

at URI ' /_layouts/15/metadata/json/1'.

Error details: 'An error occurred while sending the request.'. HTTP headers

received from the server - ActivityId: 9d9e3fc8-39ac-40f9-b61b-93a117c04f60.

NodeId: test-wfserver-01. Scope: /SharePoint. Client ActivityId :


At line:1 char:1

+ Register-SPWorkflowService -SPSite "”

-Workf ...

+...... + CategoryInfo          : InvalidData: (Microsoft.Share...WorkflowService:

   RegisterSPWorkflowService) [Register-SPWorkflowService], InvalidRequestExc


    + FullyQualifiedErrorId : Microsoft.SharePoint.WorkflowServices.PowerShell


PS C:\Users\ebloginadmin>

As I did not have DNS published yet for my web application. So basically the Register-SPWorkflowService command was trying to connect to the SharePoint URL end point (http://xxxx/_layouts/15/metadata/json/1 ) which has the host header. 

So to avoid this error I have added the SharePoint web application parent site collection URL to the Workflow manager server host file and was able to run Register-SPWorkflowService command 

These are the steps to edit host file on workflow server

Right click on note pad on workflow server as select “Run as administrator”. Go to the file from menu option click “Open”

Navigation to the following location to open host file C:\Windows\System32\Drivers\etc

Select file type as “All Files” then then open the file called “Hosts”

Add new entry in the host file as WorkflowSiteCollectionURLWitoutHttp 

Note: refer to the IP of your front end server hosting workflow web application and site collection, in my case the URL was (

Re-run the Register-SPWorkflowService command and you should be able to connect your workflow server with SharePoint farm.

Register-SPWorkflowService –SPSite "https://Your workflowsitecollecitonURL" –WorkflowHostUri "http://Workflow serverUrl:12291/"

More Blogs

Contact us

To begin your digital transformation, get in touch.

We’re pleased to address any inquiries you might have and assist you in selecting the service that best suits your requirements.

Your benefits:
Speak To Us