Error (401) Unauthorized when integrating SharePoint with two K2 Servers
KBS100049
PRODUCTIssue
This article describes integrating one Sharepoint web-application with two K2 Servers. I am doing it according to the following article:
http://help.k2.com/kb001753
The following steps were completed:
1. Deploy the app, specifying K2 Server1 - everything is ok.
2. Run the registration wizard, specifying K2 Server1 - everything is ok.
3. Run the registration wizard, specifying K2 Server2 - and the following error appears on the final step: "Thread 1: The remote server returned an error: (401) Unauthorized."
4. After deploying the app again, specifying K2 Server2 - everything is ok.
5. After running the registration wizard, specifying K2 Server2 - this time everything appears ok.
6. After navigating to Manage App Activations page as per the article - http://help.k2.com/kb001753, the following error appears: "Thread 1: The remote server returned an error: (401) Unauthorized"
After checking the event viewer, the error is now logged against K2 Server1.
Symptoms
Firstly, check if the registration wizard passed on both servers with no issues. It passed for the dev server URL but failed for the test server URL.
The certificates on these servers do not match and as a result only one server is able to communicate with the SharePoint server, this is based on the Kb article: http://help.k2.com/KB001632.
Troubleshooting Steps
The following steps were taken to resolve this issue:
- Ensure that the certificates between the 2 servers match as per http://help.k2.com/KB001632. We copied certificate from K2 TEST to K2 DEV.
- Restart K2 Hostserver Service on K2 DEV.
- Run AppDeployment.exe on the SP Environment and specify K2 DEV server for the Server URL.
- Run the Registration wizard from the SharePoint App Catalog, and specify the K2 TEST - this completed successfully.
- Re-run the Registration wizard and specify K2 DEV – make sure it completes successfully.
- Open App Activations and verify that you can select both servers in order to activate the app for each site collection.
Previously at this stage the error appeared and it was resolved as follows:
> Remove the certificates on the server where you can not activate the site collection - i.e. K2 TEST server. This was done by following a Outh Repair steps outlined in the Outh Repair.docx.
> Run a repair on the K2 TEST server. In this scenario the server was pointing to the incorrect database server, this was corrected.
> Run a reconfigure on the K2 DEV server - this is done to ensure that this server points to the correct database server.
> Run AppDeployment.exe on SP Environment and specify the K2 TEST server for the Server URL.
> Run the Registration wizard from the SharePoint App Catalog, first specify the K2 TEST.
> Then re-run the Registration wizard and specify K2 DEV.
> Activate and Deploy the app on TEST SP site collection and DEV SP Site collection for each environment.