Failed to query the OAuth S2S metadata endpoint
URI SP2013 register workflow service error
15 November 2013
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 "https://eblogin-Intranet.net/sites/WFConnection" –WorkflowHostUri "http://test-wfserver-01:12291/"
I received the following Error message in SharePoint management shell window. PS C:\Users\ebloginadmin> Register-SPWorkflowService -SPSite " https://eblogin-Intranet.net/sites/WFConnection " -WorkflowHostUri "http://test-wfserver-01:12291/" Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint at URI 'https://eblogin-Intranet.net/sites/WFConnection /_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 : 8a118525-866d-4539-9a69-ad747a7c1879. At line:1 char:1 + Register-SPWorkflowService -SPSite " https://eblogin-Intranet.net/sites/WFConnection” -Workf ... +...... + CategoryInfo : InvalidData: (Microsoft.Share...WorkflowService: RegisterSPWorkflowService) [Register-SPWorkflowService], InvalidRequestExc eption + FullyQualifiedErrorId : Microsoft.SharePoint.WorkflowServices.PowerShell .RegisterSPWorkflowService 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
172.160.2.77 WorkflowSiteCollectionURLWitoutHttp
Note: 172.160.2.77 refer to the IP of your front end server hosting workflow web application and site collection, in my case the URL was (eblogin-Intranet.net)
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/"