Deploy Asp. NET Core Web App and on Azure

Source: Internet
Author: User
Tags app service

Deploy Asp. NET Core Web App and on Azure

In the era of cloud computing, when you want to deploy a website, the first choice must be a variety of cloud services. So what kind of cloud services can be used to deploy an ASP. NET Core website in the quickest way? Azure's Web App service is a good choice.

Next we will create an Core demo application through Visual Studio, and then deploy this demo application to the Azure Web App. By reading this article, you will learn how to create an Asp. NET Core application and how to create a Web App on Azure and deploy an Asp. NET Core application.

What is Azure Web App?

Web App is a computing resource provided by Azure for running websites and Web applications. For a simple example, you can think of it as a virtual directory under IIS. You only need to upload a Web application to a specified place to provide Web services.
Azure Web App has a lot of features, but I want to emphasize only one: simple!

Create an Asp. NET Core application

To create an Core application using Visual Studio, you must first install. net core vs tool. For more information, see here. Next we will create an Asp. NET Core demo application.

Open Visual Studio to create a project, and select Web-> ASP. NET Core Web Application (. NET Core) template.

In the create ASP. NET Core Web Application (. NET Core) dialog box, select the "Web Application" template. Then modify the Authentication type to "Individual User Accounts ". In this case, the application created using the template contains the user-managed module. Cancel the "Host in the cloud" option and click OK.

Even if the Demo program is created, you still need a little setup to make it run correctly.

Press F5 to run the demo application locally and click "Register" to Register a new user. After you fill in the information and press the "Register" button, you will receive the following error:

The general meaning is that the database is not set up, and the solution is also described above. There are three solutions:

1. Click Apply Migrations.
2. Run the "Update-Database" command in the Package Manager Console of Visual Studio.
3. Run the dotnet ef database update command.

Select the second method here:

Then restart the website and register a new user. Everything is OK!

At this point, the creation of Asp. NET Core Web applications is complete.

Create an Azure Web App

You can create Azure Web App services in different ways, for example, directly on the Azure website. You can also use Visual Studio to directly create an Azure Web App when publishing an application. The following describes how to create an Azure Web App using Visual Studio.
Right-click the name of the created Project and select Publish ".

In this step, you need to enter your MS subscription account (all resources on Azure are managed through your account). After logging on, click the new button to start the creation process:

The default Service type is Web App, so no configuration is required. Select or create a Resource Group/App Service Plan. Resource Group is the logical unit of Resource management. You can use Resource Group to manage the resources it contains, mainly for authorization. Simply put, the App Service Plan manages your resource allocation. You spend one or ten yuan to allocate different resources. Click Explore additional Azure services to create a database.

Databases are used in our applications, so we need to create databases on Azure. Now go to the database creation process and click the plus sign in green on the right side:

The database is created in two parts. Create an SQL Server database Server and then create a database instance on the database Server.

Therefore, you must first create a database server when creating a database:

The following is the interface for creating a new database server. Enter a proper database server name, set your username and password, and click OK:

Next, go back to the database creation interface. At this time, the database server has been set, and you only need to enter the database name. Click OK to go to the next step:

The following figure shows how the database configuration is added. Click the Create button to Create all the configurations:

So far, we have created Azure Web apps and cloud databases. Next, let's see how to publish the Asp. NET Core application to the Azure Web App.

Deploy Asp. NET Core applications

After creating the Azure Web App, we will return to the deployment process. In the Connection tab, the settings we see are all default values, and do not need to be modified if there are no special requirements. Click to go to the Settings tab:

You can use the default value for basic configurations. We need to select the database connection string and Apply this migration on publish. Then click the Publish button to Publish to the cloud:

Depending on your network conditions, the release process may last for a while. After the release is complete, you can view the application in the browser.

Simple Test

Our application has an important feature: users can be created and logged on. After the release, you must test this function, because we have not done anything to create this function.

Next try to create a new user

Good, after the creation is complete, the user has logged on.


This article describes how to create an Asp. NET Core application and deploy it to the Azure Web App Service through detailed operation steps. I hope to help anyone who is interested. We also hope that you can support the customer's home.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.