Azure – Web deployment to Azure VM failed

azure

I am currently following the tutorial here
to deploy an ASP.NET app to my Azure VM using Visual Studio. There are two pre-requisites listed for the tutorial; I fulfill them both.

Unfortunately, I keep encountering this error:

Web deployment task failed. (Could not connect to the remote computer
("XXX.westeurope.cloudapp.azure.com") using the specified process
("Web Management Service") because the server did not respond. Make
sure that the process ("Web Management Service") is started on the
remote computer. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)

Running the command net start wmsvc gives me the following response:

The requested service has already been started.

When I run netstat -an, I can verify that Port 8172 (to which I am trying to deploy my ASP.NET app) is listening:

TCP 0.0.0.0:8172 0.0.0.0:0 LISTENING

I have also ensured that there is an inbound security rule inside my firewall to allow all connections to Port 8172 via TCP. On my Azure portal, I have added the same security rule too.

Any ideas on how I may fix this issue?

Best Answer

After hours of trial and error (along with copious amounts of Googling), I managed to fix the issue.

The information provided by the tutorial here is incomplete/inaccurate. It is not sufficient to install Web Deploy simply by following the instructions given -- in fact, the claim that "Once Web Deploy is installed, the Web Management Service is started and set to automatic startup" (my emphasis) is false. Here is a screenshot taken from the IIS tab in Server Manager:

enter image description here

As you can see, the Start Type of Web Management Service is Manual.

After downloading and installing Web Deploy 3.6, one has to go to Programs and Features, find Microsoft Web Deploy, and then right-click and select Change. Click Next on the first page, then Change on the second page, and one will come across this window:

enter image description here

Make sure that both IIS Manager UI Module (as well as everything beneath it) and Remote Agent Service are selected.

Once that is done, when one navigates to Server Manager and click on the IIS tab, one will see that both the Web Management Service and the Web Deployment Agent Service are now running automatically:

enter image description here

Having done all these, one can now deploy an ASP.NET app directly on an Azure VM.

Related Topic