Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't my Azure virtual machine show up in Visual Studio's Publish feature, for an ASP.NET MVC app?

I'm trying to publish my ASP.NET MVC4 web application, using Visual Studio 2013, to a virtual machine that I have up and running in Azure. The virtual machine has IIS installed on it.

I'm not using the Azure Web Sites feature because it does not support virtual networks, yet, and thus cannot be configured to connect to a SQL Server database, running on an Azure VM, using a private LAN IP. So, this publish question does not pertain to the simpler publish-to-azure-websites feature.

The GUI for Visual Studio's publish feature first starts with a prompt to select my target publish destination. On this prompt, I choose to publish to a Windows Azure Virtual Machine. It's brings up a prompt that has a drop-down menu in which I expected to be able to select my existing virtual machine. There's a loading spinner icon which makes me think it's connecting to Azure to query for the available VMs. My VM is never select-able though - the drop-down list is empty. It shows that I'm signed in using the expected username.

What do I have to do to make my VMs, within Azure, appear in this drop-down list so that I can easily publish to them?

I've installed a complete installation of Web Deploy and I created an endpoint for TCP port 8172.

like image 267
Ryan Avatar asked Jul 17 '14 01:07

Ryan


People also ask

How do I enable publishing to Azure Virtual Machine?

Select the project, right click and select publish. On the publish window, expand More Options and select Microsoft Azure Virtual Machines. You will be then asked to login to the Microsoft Azure account. Login to your Azure account and then select the Windows VM you have created already.

How do I make an Azure Virtual Machine in Visual Studio?

Setup Visual Studio 2022 VM in AzureNavigate to the Azure Portal at https://portal.azure.com and login to your Azure Subscription. Navigate to the Azure Marketplace and search for Visual Studio 2022, then click on it in the list. Select the Visual Studio 2022 edition to install, then click Create.

How do I publish from Visual Studio to Azure?

Create or open an Azure cloud service project in Visual Studio. In Solution Explorer, right-click the project, and, from the context menu, select Convert > Convert to Azure Cloud Service Project. In Solution Explorer, right-click the newly created Azure project, and, from the context menu, select Publish.


2 Answers

The reason the VM does not appear in the Select dropdown list is probably because:

  1. web deploy is not setup on your VM that is already provisioned on Azure, or
  2. not allowed through firewall for inbound connection or
  3. the web management service is not started or
  4. it is a windows 8 or 8.1 system
  5. [Update] You have an outdated version of Azure SDK (This was the issue in my case). Get The latest Azure SDK Here: http://azure.microsoft.com/en-us/downloads/
  6. OR Download it using Visual Studio itself from Menu option Tools > Extensions and Updates (assuming you are using VS 2013) Azure SDK Update Available

The following article describes all the steps to setup web deploy publishing on a windows server system: Troubleshooting Web Deploy problems with Visual Studio

The following article describes Web Deploy cannot be setup with Windows 8 or 8.1 system. Installing and Configuring Web Deploy on IIS 8.0 or Later

Hope this helps someone.

like image 133
Steve Johnson Avatar answered Oct 02 '22 06:10

Steve Johnson


The simple answer was to use the IIS component installer application to install WebDeploy. Once WebDeploy is installed, and the ports for it are opened on the firewall, Visual Studio will be able to publish to that machine. Visual Studio's publish dialog may be empty for a few seconds, but I think it's downloading the details of the machine or something, because it will eventually appear in the publish-to drop-down.

like image 30
Ryan Avatar answered Oct 02 '22 05:10

Ryan