Create ASP.NET Web App In Azure

Prerequisites

  • Microsoft Azure Account: If you do not have an Azure account, you can open a free Azure account. It comes with a one-month free trial.
  • Visual Studio 2013/2015: You need to have Visual Studio installed on your machine.
  • Install the Azure SDK for Visual Studio 2015 or the Azure SDK for Visual Studio 2013.

Let’s Start

Create an ASP.NET MVC web application

  1. Open Visual Studio from the file menu, and then click New, Project.
  2. Under templates, select Visual C#, Web, then ASP.NET Web application.
  3. Provide an appropriate project name, in my case it is ‘DSWebAppSample1’,
    .NET Framework
  4. Click OK. Select ‘MVC’ from ASP.NET templates in the next screenshot. Click the ‘Change Authentication’ button. Make sure the ‘Host in the Cloud’ checkbox is checked and the ‘Web app’ is selected.
    ASP.NET
  5. Select ‘No Authentication’, OK, and then click OK.
  6. If you are not already logged in to Azure, Visual Studio prompts you to do so. Sign in with the ID and password of the account that you use to manage your Azure subscription.
  7. Once you're signed in, the Configure Microsoft Azure Web App Settings dialog box asks you what resources you want to create. Provide a unique Web app name (this would b the first part of URL). Select ‘Create a new web service plan;' give some meaningful name. Create a new resource group and give some meaningful names. Select a region based on your location. Click OK.
    Microsoft Azure
  8. It will take a few seconds to create the project. It will ask to select a source control and if you have TFS or Git configured, you can select one otherwise cancel the popup.
    Source control
  9. Once the project is created, you can check the Azure App Service Activity window to see details.
    Overall status
  10. Do some visible changes: Go to Project, Views, then click Home. Open index.cshtml and put some personalized content in the first div. Now we are all set.
    Project

Deploy web app to Azure

  1. In Solution Explorer, select a project, then right-click and Publish. It will open publish web dialog box and click ‘Next’.
    Solution Explorer
  2. In configuration, ensure ‘Release’ is selected and click Next, then Publish. It will take some time to publish on Azure, you can see the process in the output window:
    Output
  3. Once it’s published, it will open in the browser.
    Azure
  4. Your web app is in Azure now, anyone with the URL can access this site.

Server Explorer- Open & edit remote files

  1. You can use Server Explorer to open and edit remote files for debugging or minor changes.
  2. Changes done here will directly reflect on the web app without any deployment.
  3. Open Server Explorer in Visual Studio, Azure, and then select App Service.
  4. Select ‘Your App Service’ and then ‘Your Web application.
  5. Expand the Web application; go to Files, Views, Home, then click Index.CSS HTML
    Web app
  6. Make some visual changes in HTML and save the file.
  7. Refresh the page in the browser and the latest changes should be available.
    Getting started