Installing WebDeploy on Windows Server and pitfalls to avoid
You have a web server with and you want to use the handy Publish via WebDeploy/MSDeploy feature in Visual Studio to deploy your websites up to the server. Great! However, setting up WebDeploy on a server is a pain in the arse because there are several places it can go wrong and there is a reliance on things being done in the correct order.
I’m not going to go into detail about configuring WebDeploy in this post because that bit is super easy and there are many articles on this. This article is mainly for my records since although installing WebDeploy is a task done rarely it can be extremely frustrating and take far too long if got wrong.
The right and easy way
I've seen articles and Stackoverflow questions asking about differences in installation between versions 3.5 and 3.6 but provided you follow the steps below, there should be no differerence.
Install Management Service. This can be done on the server via the Add Roles and Features tool, expanding "Roles > Management Tools";
Install the standalone WebDeploy 3.5 or 3.6, selecting “Complete” as the install option.
Ensure that the Management Service is running either by check in IIS or the Services management console. This is not necessary for WebDeploy to be installed but it is necessary for deployments to take place.
Ensure that the Windows Firewall has a rule allowing incoming traffic on port 8172. This should be added automatically during the WebDeploy installation but it's always worth checking. If you have a external firewall, you will need to add the port to this.
Pitfalls to avoid
There are several pitfalls to avoid when installing WebDeploy.
Do not install Webdeploy via Web Platform Installer (WPI). Use the standalone installer. Many/most articles I have read suggest using WPI to install WebDeploy however I find this misleading as the same articles generally do not point you to install the Management Service first and if this is not installed you generally have to uninstall WebDeploy, install the Management Service and reinstall WebDeploy.
Also, I have found that the WPI route does not always install the "Complete" option. This may be the same issue as not having the Management Service installed but I have better things to do that experiment with that.
Do not install WebDeploy before Management Service. As I say above, this will just waste you time.
Do not install WebDeploy 3.5 and 3.6. If your installation of one version doesn't work and you think you'll be better off trying the other version, uninstall first and then carry out the new install. For some reason (again don't shoot me for not wanting to experiment) the second install will seemingly not overwrite many of the settings of the first install and so will continue not to work.