Once again, mainly for me, because it was a slight pain in the ass.
You have to have an EC2 server already set up. I’m not going to cover that.
If you just try to publish to your EC2 server from Visual Studio using a newly created Web Deploy profile, you will likely get a lot of errors.
Firstly, within your EC2 admin page, you need to allow for inbound connections on port 8712, which is what the Web Management Service uses. Oh, you also need to make sure this service is started and set to start automatically. Without either of these, you won’t even be able to connect.
You might still get some errors. Within Visual Studio 2013, there’s a verify connection button when you set your authentication credentials and whatnot. If/when it fails, there is a link that will appear that gives you some more information.
You should also be looking at your Inetpub log directory to see what exactly gets logged when the verification fails.
One odd error was logged as a 403 503 error. Well, 403 means forbidden, that’s obvious, but 503 is not a normal sub-status message. It took me a little digging to figure out that you need to go into IIS Manager, select Management Services, and allow remote connections (you need to stop the service to allow you to change the setting).
After that, I was getting a 404 7 error. This was because I did not have Web Deploy installed (which can be installed from the Microsoft Web Platform Installer). Most message I saw said that Web Deploy 2.1 needed to be installed, but on a Windows 2012 Server, it looks like Web Deploy 3.5 is what does the trick.
At this point, you might get a nice ‘Verification successful’ message and think you are good to go. Then you try to publish, and you get the old odd message about web.config having a bad section because you haven’t set a virtual directory or whatnot, which is odd if you can actually see your previously deployed web site. What you really just need to do here is nuke your obj folder at the source site, and then try to publish again.
This works, or at least worked for me.