java
php
c
ajax
mysql
database
xcode
ruby-on-rails
regex
visual-studio
multithreading
eclipse
flash
html5
perl
algorithm
facebook
tsql
api
dom
Make sure you have the WMSvc Service (Web Management Service) set to 'Auto' (and started) so it's on when you restart & check out this link http://learn.iis.net/page.aspx/516/configure-the-web-deployment-handler/
I've had this one come up on a few occasions after having just successfully deployed a WebApp on a server running IIS 7.5. Obviously since a deployment/publishing was done successfully on the server just before this error came up, there was very little that could have gone wrong on the server setup/configuration (unless the previous successful deployment did something horribly wrong and removed some configuration parameters on the server).
After having rebooted the server, checked that Web Management service and Web Deployment service were running correctly, and verified from cUrl tool that a GET of the MsDeploy.axd was successful there was only one thing left to do. Restart Visual Studio. Magically post restart of VS publish started working again. All on its own. Magical stuff, this Web Deployment :)
Make sure you have set Site/Application correctly in publish profile:
You get the same error message if you spell site or application name wrong.
Although a lot of different unrelated things can contribute to getting the 404, I solved it for my by.
After this, everything works fine. Assuming the Web Management Service is setup correctly (mine is configured to accept remote connections, the firewall port was opened, and the user I'm uploading with was added to every single Site that I want to deploy to (using the IIS Manager Permissions icon in each Site node in the IIS Manager)).
I got this error because I changed my password. The deployment wizard still saved my old password, after retyped my password, everything works fine now.
This same message would occur almost at random when publishing projects from visual studio 2010.
The fix was to delete the $projectname.Publish.xml file (in the root directory of the project) and re-create it.
$projectname.Publish.xml
If you are using an SSL certificate you should go into Management Service under the IIS Manager section of Server Manager and stop the service, select the correct certificate and then start the service again. This is what worked for me (I was getting Forbidden message).
We found the issue was because WebDeploy was installed before the Web Management Service feature was enabled on a Windows 2008 server. After Web Management Service is installed, uninstall Web Deploy fully. Then resinstall and make sure all components of the package are selected.
Following the reinstallation we were immediately able to publishing to the server from my local machine, and also from our CI.
A couple of points to note after reading the other answers: