“There are no addresses available for this application” error while installing SharePoint App

Probably the most common error which you will see when will try install SharePoint App in on-prem environment is  “There are no addresses available for this application”

The reason is missing some required configuration like services and settings.

The error can be seen in both cases when you try to deploy app using PowerShell or Application Center.

Here is the powershell sample

Add-PSSnapin Microsoft.SharePoint.PowerShell;

$spapp = Import-SPAppPackage -Site https://SPHVM-2906 -Path c:\temp\My_App.app -Source ([microsoft.sharepoint.administration.spappsource]::DeveloperSite);

Install-SPApp -Web 'https://SPHVM-2906' -Identity $spapp;  

 

If you will try to deploy from Visual Studio you will see an error like this

 

 

The main reason is that SharePoint Apps require two services: App Management Service and SharePoint Foundation Subscription Settings Service. Ensure that both are installed and running.

Add these services if they are not in list and do not forget to start the services

 

Also check that web application is started.

Restart IIS form UI or running IISRESET from comand line.

 

And here is small code sample how to uninstall application 

Add-PSSnapin Microsoft.SharePoint.PowerShell;

$installedapps = Get-SPAppInstance -Web https://SPHVM-2906

$yourInstalledapp = $installedapps | where Title -eq 'My App'

$yourInstalledapp

Uninstall-SPAppInstance -Identity $yourInstalledapp