The error mentioned in the title we normally come across while publishing a web application from Visual Studio using web deploy. This is a generic error message so that there are various reason behind it depends on the web deploy settings and configuration. I would like to point out two configurations I missed, when I configured it recently.
Management Service should be configured to allow remote connections
Open the Internet Information Services Manager and select the machine name node. In the Features view, scroll down to the Management section. Double click the Management Service icon, and verify that Enable Remote Connections is checked. You must stop the service to make changes, so be sure to restart it when you are done.
IIS Deployment Handler and Remote Agent Service should be installed
In the Programs and Features control panel, find Microsoft Web Deploy 3.5(version depends), right-click and choose Change. In the Wizard that comes up, click next on the first page, and then choose “Change” on the second page. Add IIS Deployment Handler and everything under it.