How to setup a new Windows Server with ASP.NET MVC Application on Azure Virtual Machine

  • Home
  • /
  • Blog
  • /
  • How to setup a new Windows Server with ASP.NET MVC Application on Azure Virtual Machine
Try Free SQL Trainer - learn by doing!
SQL queries made easy - Natural Questions to SQL Converter.

[tagline_box backgroundcolor=”white” shadow=”no” shadowopacity=”0.7″ border=”3px” bordercolor=”#F6F6F6″ highlightposition=”left” content_alignment=”left” link=”” linktarget=”_self” modal=”” button_size=”” button_shape=”” button_type=”” buttoncolor=”” button=”” title=”Table of contents” description=”” margin_top=”” margin_bottom=”20px” animation_type=”0″ animation_direction=”down” animation_speed=”0.1″ animation_offset=”” class=”” id=””]

[/tagline_box]

1. Setting Free Trial Account on Azure

Go to – https://azure.microsoft.com/en-in/pricing/free-trial/.

Setup Free Trial Azure account

1.1 Enter email and check I am a new user. Click “Sign in using our secure server”.

1.2 If you already have Microsoft ID, please sign in else create new Microsoft ID clicking “Sign up now”.

Sign in to Microsoft Azure

1.3 Fill in your email id and create a password.

Create Microsoft Account

1.4 After verifying email id, enter your credit card details and complete SMS verification.

Signing up to Microsoft Azure

1.5 Go to Azure Portal https://portal.azure.com/signin and log in with your Microsoft credentials.

Log in at Azure Portal

1.6 Now you can browse Azure Portal.

Browse Azure portal

2. Creating and configuring Azure Virtual Machine

2.1 Click on New > Virtual Machines > Windows Server 2012 R2.

Creating and configuring virtual machine in Azure

2.2 Select Deployment model > Resource Manager.

Azure VM Resource Manager

2.3 Configure Basic settings.

Azure VM Basic Configuration and Settings

2.4 Choose Virtual Machine size.

Azure VM Choose virtual machine size

2.5 Configure Storage and Network settings.

Configure storage and network settings

2.6 Review the summary and click OK.

Azure virtual machine configuration summary

2.7 Now we will configure Security Group (Network Security Settings).
Go to All Resources and  select Network security group which belongs to the new virtual machine.

Azure virtual machine security settings

2.8 Select Inbound Security Rules.

Azure VM inbound security rules configuration

2.9 Add a new security rule. Select TCP protocol and enter Destination port range number 80.

Azure Inbound Security Configuration

2.10 Add another security rule. Select TCP protocol and enter Destination port range number 8172

Virtual machine inbound security rules settings

3. Connecting to Azure VM remote desktop

3.1 Go to All Resources and select Virtual Machine.

Remote desktop connection to Azure virtual machine

3.2 Click “Connect” and download the remote desktop connection application file (.rdp). 

Azure VM connecting to virtual machine

3.3 Go to the folder where you have saved the .rdp file.

Connecting to virtual machine in Azure

3.4 Right-click on the .rdp file and select Connect.

Connecting to Azure remote desktop

3.5 Click Connect again to allow remote connection.

Connect to Azure VM remote desktop

3.6 Enter you credentials.

Connect to Azure remote desktop: enter credentials

3.7 Check “Don’t ask me again” checkbox and click “Yes”.

Azure remote desktop connection settings

4. Setting IIS on Azure Virtual Machine

4.1 Open Server Manager by clicking on its icon on the taskbar.

Setting IIS on Azure virtual machine

4.2 Click “Add roles and features”.

IIS configuration: add roles and features

4.3 Roles and Features Wizard opens. Click “Next”.

IIS Add roles and features wizard

4.4 Select “Role-based or feature-based installation” and click “Next”.

Role-based or feature-based installation option of IIS on Azure

4.5 Select “Select a server from the server pool”, then choose your server and click “Next”.

IIS on Azure Select a server from a server pool

4.6 Select “Web Server (IIS)” from “Server Roles” list and click “Next”.

Select "Web Server (IIS)" from "Server Roles"

4.7 Select following features:
.NET Framework 3.5 Features,
ASP.NET 4.5.

Select .NET Framework and ASP.NET features for virtual machine

4.8 Click “Next”.

IIS on Azure, Add Roles and Features Wizard

4.9 Let’s select Role Services: select items highlighted on the screenshots below and click “Next”.

Add Roles and Features Wizard: Adding Role Services

Add Roles and Features Wizard: Adding Role Services

Add Roles and Features Wizard: Adding Role Services

Add Roles and Features Wizard: Adding Role Services

4.10 Click “Install” and wait until the installation is complete.

Finishing the IIS installation on virtual machine

4.11 Click “Close”.

Finishing the installation of IIS on Azure VM

5. Installing Web deploy package on Azure VM

5.1 Go to http://www.microsoft.com/web/downloads/platform.aspx, download, and run Microsoft Web Platform Installer.

Installing Web deploy package on Azure virtual machine

5.2. Using the installer search field, find and select Web Deploy 3.6 and click “Add”

Choosing Web Deploy package for virtual machine

5.3 Then click “Install”.

Install Web Deploy package on Azure VM

5.4 Accept the Microsoft license terms, then wait until the end of the installation and click “Finish”.

Accept Microsoft License

 

Web Deploy package installation on Azure

 

Finishing installation of Web deploy package on Azure virtual machine

6. Creating ASP.NET MVC Application using VS2015 Web Express

6.1 Start VS2015 Web Express and create a new project.

Creating ASP.NET MVC application using VS2015 Web Express

 

VS2015 Web Express Start Page

 

Creating new project in VS2015 Web Express

6.2 Choose ASP.NET Web Application from Templates > Web.

Choosing project template in VS2015 Web Express

6.3 Select MVC template.

Selecting MVC template in VS2015 Web Express

6.4 Your ASP.NET application was created! In the next section, we will show how to deploy it.

Creating ASP.NET MVC application using VS2015 Web Express

7. Deploying ASP.NET MVC Application from VS2015 Web Express

7.1 Right-click on your project name in the explorer panel (it is highlighted on the screenshot) and select “Publish”.

Deploying ASP.NET MVC Application from VS2015 Web Express

7.2 Select “Custom” publish targetagain.

Deploying ASP.NET MVC Application: choose Custom profile

7.3 Enter Profile name and click OK.

Deploying ASP.NET MVC Application: name your profile

7.4 Go to Azure panel again. Go to All resources and select your virtual machine. Copy and note down the Virtual Machine Public IP Address.

Deploying ASP.NET MVC Application: copy and note down IP address

7.5 Now go to IIS Manager panel again. Check the Connections panel on the left and copy the site name under Sites

Deploying ASP.NET MVC Application: Copy site name

7.6 Return to the VS2015 Web Express and fill in the Connection settings. Here you will need your IP address and site name from previous steps. Then click “Publish”.

Deploying ASP.NET MVC Application on virtual machine: publish your app

7.7 Check the “Save this certificate for future sessions” checkbox, then click “Accept” to accept the security certificate.

Accept security sertificate to deploy your ASP.NET app

7.8 Now a green checkmark should appear near to Validate Connection button. Click “Next”

Deploying ASP.NET MVC App: Publishing the app

7.9 Set Configuration to Release, check all 3 checkboxes in File Publish Options, and click “Next”.

Deploying ASP.NET MVC Application: publishing settings configuration

7.10 Here you can preview the app, but we will just click “Publish” to finish the deployment process.

Deploying ASP.NET MVC Application with VS2015 Web Express: final step

7.11 In Visual Studio output console you can see the “Web App was published successfully” message and the IP address to access the app.

ASP.NET application is published successfully from VS2015 Web Express

7.12 Congratulations! This is is your newly deployed ASP.NET application. Now you can play with it further, or try our AWS Web Server Setup Tutorial. 

ASP.NET MVC application deployed and live on Azure Virtual Machine

prev
next