Install Orchestrator fails with error: Site UiPath Orchestrator not found

Upgrading Orchestrator fails when copying new files and no error message is shown

Trying to install or upgrade UiPath Orchestrator (any version) will fail (and/or rollback install), while having the following error in the extended install logs ( from cmdprompt: >UiPathOrchestrator.msi /lv* “C:\temp\InstallLog.txt”)

System.ArgumentException: Site UiPath Orchestrator not found.
   at UiPath.Orchestrator.Setup.Configuration.IisConfiguration.CreateWebApplication(String siteName, String webAppName, String physicalPath, String applicationPoolName, Boolean preloadEnabled)
   at UiPath.OrchestratorCAs.AllCustomActions.CreateIdentityWebApplication(OrchestratorSession orchSession)
   at UiPath.OrchestratorCAs.AllCustomActions.UpgradeIisConfiguration(Session wixSession)
CustomAction Orchestrator_UpgradeIisConfiguration returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 16:50:29: InstallFinalize. Return value 3.

Checking EvenViewer there is no meaningful information found.

How to troubleshoot it:

  1. Enable extended install log as described above. Collect log from install/upgrade.
  2. Review log and locate “Return value 3” string.
  3. Note the beginning of the error which indicates that Site UiPath Orchestrator not found.
  4. Check the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\UiPath\UiPath Orchestrator registry key and note that WebSiteName key should have the same value as in IIS console:

If the site name does not corresponds, rename it on IIS Console to "Uipath Orchestrator"