Share via


Azure: Create And Deploy An ASP.NET Core Web App

Note : This Article Participated in Technet Guru Competition December 2017 and won Silver Medal.

Introduction

Nowadays, most people are choosing web hosting on a cloud platform. Microsoft lovers like us basically select "Microsoft Azure" as our hosting environment. That’s the reason for this new article defining a simple way of hosting in Azure.

Before reading this article, you must read the articles given below for ASP.NET Core knowledge.

Azure Account

First, we need to create an account on the Azure portal. Only then can we host the application in the cloud environment. So, please check the following steps to create an Azure account.

Azure Account Registration

Create an account through this link to Azure Portal.

Domain Registration

We need to host our application in a particular domain. Check the following steps:

  1. Click "All resources" on the left side menu and it will open a dashboard with an empty or already existing list of resources that we have created earlier.

  2. Click the "Add" button and it will open another window with multiple options. We can choose an appropriate option to host our application.

  3. As per our requirement, we chose "Web + Mobile" and clicked the "Web App" on the right side.

4. It will open another form to fill up our app details to host. We need to give a unique name in the "Appname" section and it will create a subdomain for our ASP.NET Core application.

5. We chose subscription as "Free Trial" because we created a free account on the Azure portal.

6. We need to host our app resources in Resource Group. First, we need to create a Resource Group name in our Azure account. But we chose Existing Resource Group name "AzureDemo" that we are already created in our Azure account.

7. "OS (Operating System)" we selected as "Windows" (as per our requirement).

8. We can create our own App Service Plan name.

9. Application Insights will give you the more clarity about your hosted app like analytics, etc.

10. Click the "Create" button and wait for the build success.

11. Another way to create the Resource Group Name: click "Resource Groups -> Add".

12. Once the build succeeds, then we see this output.

Simple steps to create an ASP.NET Core Application

  1. Open VisualStudio and click File > New > Project.
  2. Select Visual C# > Web > ASP.NET Core Web Application.
  3. We have given our application name as "MyFirstAzureWebApp".
  4. Click OK.
  5. Click "Ctrl+F5".

App Publishing into Azure

We created a default ASP.NET Core application (we have done some changes in UI Section) for the publishing process.

1. Right-click on the application and click the Publish menu.

2. Click "Microsoft Azure App Service".
 

3. We choose our existing resource group name (that we created: "AzureDemo") in our Azure Portal and It will display the App Name inside the "AzureDemo" folder.

This will display only when we login through the Visual Studio using Azure credentials (Email & Password).

Reference

See Also

It's recommended to read more articles related to ASP.NET Core.

OutPut

The application is hosted in a given domain address http://menoth.azurewebsites.net

Summary

We learned how to create and deploy an ASP.NET Core web app in Azure. Hope this article is useful for all ASP.NET Core and Azure beginners.