Publishing ASP.NET Web Site To Azure From Visual Studio 2015

In this article we will see steps to publish ASP.NET Web Site to Azure from Visual Studio. You will need the following to start with.
  • An Azure Subscription
  • Visual Studio 2015 on-premises or on Virtual Machine on cloud.
Step 1 - Start Visual Studio, File, New, then WebSite. Choose ASP.NET Empty Web Site.
 


If you are logged in to Visual Studio with the same login as your Azure subscription, you will see a Cloud Explorer with details of Resource Types and Resource Groups.



Step 2 - Right Click on the Solution Explorer, Add New Item, and then Add HTML Page and name it Index.html,
Change Title, and add an H1 tag as below. There is not a great deal here since we only want to see the publishing process. And the process I'm using here is exactly the same regardless of whether this is a full-fledged, data-backed application.
 
 
Step 3 - Right Click  Publish WebApp. You will see the below dialog box.
 
 
Step 4 - Click on Microsoft Azure App Service. If you have more than one subscription, you can select which one you want to use.
 
 
Step 5 - Click New and enter the name details. This needs to be unique. Create a New Resource Group and a New Service Plan. You can even add it to an existing one. The Web App Name mentioned here is going to be the hostname of the server and it's going to default to the azurewebsites.net domain. By default it picks the project name.
 
 
Step 6 - Once Profile is created, click on Next - you will see the Connection details.
 
 
Now notice that the published method here is Web Deploy, Web Deploy package, FTP or file system. If you want to publish directly from Visual Studio, or WebMatrix, you need to select Web Deploy.
 
 
Step 7 - There are no choices in Settings Tab since this is a very simple application. In case there are Databases in an application, relevant settings will be done here. Now I haven't created separate configurations like a release configuration, but you will choose the appropriate configuration here and this will bring in things like connection strings, if you were connecting to a database.
 
 
Step 8 - Click Next and then click Publish. There is a known glitch in Visual Studio for this app type. You will see a deployment failed option. To make it work, you need to open the Web Publish Activity window and hit Publish gear as shown below.
 
 
 
 
And voila -- the web site is published from Visual Studio.
 
 
From the Azure portal, you will see this web site in the App Services section.
 
 
When you select the web site, you will see all the settings which are very important for the application.
 
 
You can add continuous deployment to this web site by integrating it with any of the available source control software as shown.
 

Read more articles on Azure:

Up Next
    Ebook Download
    View all
    Learn
    View all