Deploying ASP.NET Core Web App to Azure Cloud

Uvindu Dharmawardana
4 min readJun 24, 2021

--

From this article, I’m going to demonstrate the steps to deploying a sample ASP.NET Core Web App to the Azure cloud using the Azure Web App resource.

I hope you are going to follow me in this demonstration so here is the list of prerequisites for this demonstration.

  1. Microsoft Azure account. (For new accounts Microsoft is giving free $200 credits).
  2. Microsoft Visual Studio (IDE)

Creating Web App resource

So, Let’s start our demonstration. Once you set up your Azure account, go to the Azure portal.

From here, click on the create resource icon and from there we are going to create an Azure web app resource which will be going to use to deploy our API.

From here you have to select the resource Web App. Now we have to add the relevant configurations to this web app resource. The following figure shows the basic configurations that are required to create the Web App resource.

In the above configurations, you can see that I have set my instance to publish type as “Linux”, the reason behind that selection is you can have a better performance with a Linux type instance, it supports both Linux and Windows but in this demo, I’m going to use Linux as my instance type. And you have to select .NET Core 3.1 (LTS)/ or a higher version of runtime stack for the instance because we are going to deploy a .NET Core API. And also when you selecting the region always try to select a region where is close to you, this will also help you with the performance of your instance. And for the App Service Plan, I have selected the free F1 plan because this is a dev application and It's always better to use a free plan for the dev phase of your application.

Once you finished with all these configurations, you have to click on “Review+create”, it will create the resource for you. Now you can see that our resource is being created.

The above figure shows the overview of the resource that we have created now, If you click on the URL you can simply check the webserver that has created and deployed in the cloud. Next, let’s create the web API that we are going to deploy.

Deploying the Web App to Azure

First, you have to create a .NET Core Web App. Once you create your web app you will be able to deploy it. From the Microsoft visual studio you

Creating the Web App

  1. Go to the Microsoft visual studio and create a new project.
  2. Select ASP.NET Core Web Application as the project template.
  3. Provide project name, location, and solution name.
  4. Finally, click on the create button to create the project.

Deploying to Azure Cloud

Once you create your application you can directly publish it to Azure from Visual Studio. First, you have to log in to the same Microsoft account that you used to log in to the Azure portal from the Microsoft visual studio. then right-click on your project and select “publish”.

From the menu select “Azure” because we are going to publish to the Azure cloud.

In the next selection, you have to select “Azure App Service (Linux)”, the reason for that is when we are configuring the Web App resource we have selected “Linux” as our instance type.

In the next menu select your App Service instance and click finish.

We are almost there :), now click on publish button, First, it will build your project and deploy the project to the Web App resource we have created before.

Now you can see that my project and build and deployed successfully, now go to your Azure dashboard and select the Web App resource, click on the URL for your resource.

Now you can see that our Web App is successfully deployed in the Azure cloud and it is showing the Welcome page of the .NET Core web app. These are some very easy steps you can follow to deploy your application.

--

--

Uvindu Dharmawardana
Uvindu Dharmawardana

Written by Uvindu Dharmawardana

B.Eng Software Engineering University of Westminster

No responses yet