in the era of cloud computing, when you want to deploy a site, the first choice is definitely a variety of cloud services. Then what kind of cloud service can you use to deploy a ASP.NET Core web site in the fastest way? Azure's Web App service is a good choice. Under

, we will create a Asp.net Core demo application through Visual Studio, and then deploy the demo application to Azure Web App. By reading this article, you will be able to learn how to create Asp.NET Core applications and how to create Web App on Azure and deploy Asp.NET Core applications. What is

Azure Web App?

Web App is a computing resource that Azure provides for running a web site and a Web application. If you want to make a simple analogy, you can understand it as a virtual directory under IIS. We can provide Web services if we upload the Web application to a specified place.
Azure Web App has a lot of point, but I want to emphasize only one here: simple!

creates Asp.NET Core application

, and we want to create Asp.net Core application through Visual Studio. We need to install.Net.Net first. Let's start with a Asp.NET Core demo application.

opens the new Visual Studio new project, selecting Web-> ASP.NET Core Web Application (.NET Core) template.

src=

" is selected in the newly built "http://files.jb51.net/file_images/article/201712/201712250937526.png" template. Then the type of Authentication is modified to be "Individual User Accounts". The application created by the template at this time will contain the user - managed module. At the same time, the "Host in the cloud" option is canceled, and then the OK button is clicked.

src=

Demo program has been created, but it needs a little setup to make it run correctly.

runs demo applications locally on F5, and hits "Register" to register a new user. When you fill out the information and press "Register" button after you receive the following error:

generally mean the database is not set, the solutions are also in the above, there are three types:

1. click "Apply Migrations" button. The
2. executes the "Update-Database" command in the Package Manager Console of the Visual Studio. The
3. executes the dotnet EF database update command.

here choose second ways:

,

, the creation of the Asp.NET Core Web application is completed.

creates Azure Web App

, which can create Azure Web App services in different ways, such as building on Azure website directly. It is also possible to create Azure Web App directly in the process of publishing the application through Visual Studio. Here we will show the detailed steps to create Azure Web App using Visual Studio.
right-click the name of the project that has been created, and select "Publish".

" this step requires you to enter your MS subscription (all Azure resources are managed through your account login), click the new button to start after the completion of the creation process:

src=

Service Web App is the default type, so there is no need to configure. Resource Group/App Service Plan is selected or created below. Here is a little explanation. Resource Group is the logical unit of resource management, and it can manage its resources through Resource Group, mainly for authorization. App Service Plan is simply to manage your resource allocation, and you spend a piece of money and ten dollars in obviously allocating different resources. Then click "Explore additional Azure services" to start creating the database.

src=

", we used database in our application, so we need to create database on the http://files.jb51.net/file_images/article/201712/2017122509375212.png. Now enter the database creation process, click on the right green plus sign:

src=

database creation includes two parts. First, you create a SQL Server database server, and then create a database instance on the database server.

so you need to create the database server to create the database:

the following" is to create a new database server interface, enter the appropriate database server name, and set your username and password, and then click the OK button:

" then returned to create the database interface, the database server is set up, and then enter the name of the database as long as you can. Then click the OK button to enter the next step:

is below the" add database configuration look directly Create button to complete the configuration of the

" at this point, we have completed the creation of Azure Web App and the cloud database. Next, let's see how we publish the Asp.NET Core application to Azure Web App.

deployed Asp.NET Core to apply

to the deployment of Azure Web App after the completion of the creation of Azure Web App. In the Connection tab, the settings we see are all default values, and there is no need to be modified without special requirements. Click into the Settings tab:

,

, and src=. The basic configuration is to use default values. We need to select the connection string that uses the database, and Apply this migration on publish. Then click the Publish button to complete the

according to your network status and release process may take a little while. When the release is completed, you can see the application in the browser.

is a simple test of

. Our application has a very important function: you can create users and log in. After the completion of the release, you must want to test this feature, because we do not do anything to create this function.

trying to create a new user tester@163.com:

is also good, created after the user has logged tester@163.com.

summarizes

. In this paper, we introduce the process of creating Asp.NET Core application and deploying it to Azure Web App Service through detailed operation steps. I hope to be helpful to the interested students. We also want to support the home of the script.


This concludes the body part