When running the AppDeployment.exe on the SharePoint 2013 server and entering any K2 URL (e.g. https://k2.domain.com) and clicking on Test or Next, it fails with the following error message:
"Unable to connect to the K2 Environment with the given URL"
We checked a few things, including the following:
- The signature hash for the SSL certificate used for the K2 site should be SHA1 or SHA256 and not MD5 (verified).
- Open ports and firewall settings as per this article.
- We used Telnet client to connect to port 6332 from the SharePoint server to the K2 server.
- We tried to open the K2 AutoDiscover URL using a web browser and this failed.
You should be able to open the K2 AutoDiscover URL from the SharePoint 2013 server using any web browser.
Example URL: https://k2.domain.com/autodiscover
It should open or download a JSON file containing all the K2 URLs.
After checking IIS on the K2 server, we saw the Authentication mode "ASP.NET Impersonation" was set to "Enabled" for the AutoDiscover app (under the K2 site). Once this was disabled, we could open the URL and it worked.
On a side note, we also saw that "ASP.NET Impersonation" was enabled for a few of the other apps as well, we disabled it for all the other apps except "RuntimeServices" where it should stay enabled. Once the above was done, the K2 app could be deployed to the App Catalog.