How to setup a Windows Server with ASP.NET MVC App on AWS EC2
  • Home
  • /
  • Blog
  • /
  • How to Setup a New Windows Server with ASP.NET MVC Application on AWS EC2

How to Setup a New Windows Server with ASP.NET MVC Application on AWS EC2

Learn how to set up a new Windows Server with ASP.NET MVC Application:

1. Setting Free Trial Account on AWS

Go to – http://aws.amazon.com/free/.

Setup Free AWS account

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

1.2 Fill form below.

Fill Form to Sign Up to AWS Account

1.3 Fill in your personal or company account details.

Create AWS Account: Contact Information

1.4 Enter Credit card details and complete identity verification on the next screen.

Signing up to Amazon Web Services: Adding Credit Card details

1.5 Now go to the AWS Console and log in with your AWS credentials.

Log in to AWS Console

1.6 You can browse console navigating top-side links.

Browse Amazon Web Services Console

2. Creating and configuring AWS EC2 Instance

2.1 Click on the “Launch Instance” button.

Creating and configuring AWS EC2 Instance

2.2 Select Amazon Machine Image (AMI): Microsoft Windows Server.

Creating and configuring AWS EC2 Instance: Select Machine Image

2.3 Choose an Instance type: General Purpose, t2 micro.

Choosing Instance type: t2 micro

2.4 Configure EC2 Instance Details.

Configure AWS EC2 Instance Details.

2.5 Add Storage.

Configure storage

2.6 Tag Instance.

AWS EC2 Tag Instance

2.7 Configure Security Group.

  1. Add HTTP Port – 80
  2. Add Web deployment port – 8172

AWS EC2 security settings

AWS EC2 Security Group Settings

2.8 Review Summary and click “Launch”.

AWS EC2 Instance Launching

2.9 Create a key pair, download it, and store it in a secure place.

AWS Instance Key Pair Creation

AWS Save Key Pair

2.10 Launch Status screen. The instance you created is now launching.

AWS EC2 Instance Launch Status Screen

2.11 Now EC2 Instance is ready to use, click on the EC2 dashboard icon.

EC2 Dashboard

2.12 Then click on Running Instances.

EC2 Running Instances

2.13 Here you will see a list of your web servers. Your new IIS web server can be still initializing. We will continue to work with the server in the next section.

EC2 Running Webservers List

3. Connecting to EC2 remote desktop

3.1 Now when the server is initialized, you can connect to it. Click “Connect” button to download remote desktop file (.rdp).

Downloading .rdp file

3.2 Click “Download Remote Desktop File” to start downloading, then you will need to click the “Get Password” button.

Saving .rdp file

3.3 Click “OK” to save the .rdp file.

EC2 Remote Desktop Connection

3.4 Now click to “Get Password”, then click “Browse” and choose the folder you’ve saved your Key Pair in step 2.9.

Connect to Instance, choosing key pair

3.5 Click “Decrypt Password”.

Connect to EC2 Instance: Decrypt Password

3.6 Copy your credentials to notepad.

Connect to EC2 Instance

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

Remote Desktop connection via .rdp file

3.8 Now check the “Don’t ask me again” checkbox and click Connect again to allow remote connection.

Connect to EC2 Instance remote desktop

3.9 Enter your credentials.

Enter credentials to connect

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

Connect to EC2 Instance remote desktop

4. Setting IIS on EC2 Instance

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

Open Server Manager on AWS ES2

4.2 Click “Add roles and features”.

EC2 Roles and Features

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

Setting IIS on EC2 Instance: Roles and Features Wizard

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

Role-based or feature-based installation

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

Select a server from server pool

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

Setting IIS on EC2 Instance: Selecting server

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

Setting IIS on EC2 Instance: Selecting Features

4.8 Click “Next”.

Web Server Role

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

Role Services - 1

Role Services - 2

Role Services - 3

Role Services - 3

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

Finishing Setting IIS on EC2 Instance

4.11 Click “Close”.

Setting IIS: click Close to finish setting

5. Installing Web deploy package on EC2 Instance

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

Running Microsoft Web Platform Installer.

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

Installing Web deploy package on EC2 Instance

5.3 Then click “Install”.

Installing Web deploy package on EC2 Instance

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

Accepting License Terms

Installing Web deploy package on EC2 Instance

Finishing the installation

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

6.1 Start VS2015 Web Express and create a new project.

Starting VS2015 Web Express

Create a new project.

Create a new project in Web Express

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

Choose ASP.NET

6.3 Select MVC template.

Choose MVC Template

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

ASP.NET app is created

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 in the screenshot) and select “Publish”.

Click Publish Application

7.2 Select “Custom” publish targetagain.

Custom publish target

7.3 Enter Profile name and click OK.

Entering Profile name

7.4 Go to EC2 Management Console now and check Instances. Copy and note down Public DNS Address.

Copy Public DNS Address from Instances

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

Copy Site name from Connections

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

Publish the Application

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

Save Sertificate for future sessions and publish

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

Connection is validated, clisk Next

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

Publishing Options Screen

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

Preview Screen and Publish the App

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

Virtual machine inbound security rules settings

7.12 Congratulations! You have created and configured AWS EC2 Instance, then you have installed a web server, and also you have created and deployed an ASP.NET application. Now you can continue your experiments with EC2 on yourself, or check our guide on how to set up the same environment and deploy an ASP.NET application on Azure Virtual Machine.

Deploying ASP.NET MVC Application from VS2015 Web Express: Final Screen, App is Deployed

   

About the Author

ByteScout Team ByteScout Team of Writers ByteScout has a team of professional writers proficient in different technical topics. We select the best writers to cover interesting and trending topics for our readers. We love developers and we hope our articles help you learn about programming and programmers.  
prev
next