Azure deployment ASP. NET Core Web App

Source: Internet
Author: User
Tags app service

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

Below we will create an ASP. NET Core Demo app from Visual Studio and deploy the demo app to Azure Web app.

By reading this article, you'll learn how to create an ASP. NET core application and how to create a Web app on Azure and deploy an ASP.

What is Azure Web App?

Web apps are compute resources provided by Azure for running Web sites and Web applications. If you want to make a simple analogy, you can interpret it as a virtual directory under IIS. As long as we upload the Web app to a specific location, it can provide Web services.

The Azure Web App has a lot of a bit, but I want to emphasize only one here: simple!

create an ASP. NET Core app

To create an ASP. NET Core app from Visual Studio, you'll need to first install the. NET Core vs tool, please refer here for more information. Let's start by creating an ASP. NET Core Demo app.

Open the new project for Visual Studio and select the Web->asp.net core WEB application (. NET core) template.

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208114925913-892562034. PNG "style=" border:0px; "/>

In the new ASP. NET Core Web Application dialog box, select the Web application template. Then modify the authentication type to "individual User Accounts". The app created from the template now contains the module that the user manages. Also cancel the "Host in the Cloud" option, then click the OK button.

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208114943538-32319519. PNG "style=" border:0px; "/>

The Demo program is created, but it needs a little bit of setup to get it up and running correctly.

Press F5 to run the Demo app locally, click "Register" and register for a new user. When you fill out the information and press the Register button, you will receive the following error:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208114953054-711595042. PNG "width=" 661 "height=" 281 "style=" border:0px; "/>

The general meaning is that the database is not set up, the solution is also said above, a total of three kinds:

    1. Click the "Apply Migrations" button directly.

    2. Execute the "update-database" command in the package Manager Console in Visual Studio.

    3. Executes the dotnet EF Database Update command.

Here's a second way to choose:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/ 139239-20161208115004054-920106071.png "style=" border:0px; "/>

Then restart the site and register the new user, all ok!

Here, the creation of the ASP. NET Core Web app is complete.

Create an Azure Web App

Azure Web APP Services can be created in different ways, such as created directly on the Azure Web site. You can also create Azure Web apps directly through Visual Studio as you publish your app. We'll show you the detailed steps for creating an Azure Web App using Visual Studio.

Right-click the name of the project you created and select "Publish".

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115023632-2120918165. PNG "width=" 644 "height=" 273 "style=" border:0px; "/>

This step requires you to enter your MS subscription account (all resources on Azure are managed by your account), and click on the New button to start the process when you are done:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115033569-346434316. PNG "width=" 648 "height=" 367 "style=" border:0px; "/>

The default Service type is Web App, so no further configuration is required. Select or create the Resource group/app Service Plan below. A little explanation here is that the Resource group is the logical unit of resource management that can manage the resources it contains through Resource group, primarily for authorization. The simple point of App Service Plan is to manage your resource allocation, and you spend a dollar and 10 dollars clearly will be allocated to different resources. Then click "Explore Additional Azure Services" to start creating the database.

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115056694-632348841. PNG "width=" "height=" 363 "style=" border:0px; "/>

The database is used in our application, so we need to create a database on Azure. Now go to the database creation process and click on the Green plus sign on the right:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115108226-1467692781. PNG "width=" 704 "height=" 182 "style=" border:0px; "/>

The creation of a database consists of two parts. You first create a SQL Server database server, and then you create a DB instance on the database server. The relevant concepts can be referred to the author's " Migrating SQL Server database to Azure SQL Combat " article, not mentioned here.

Therefore, when you create a database, you need to create the database server first:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115122460-1236771157. PNG "style=" border:0px; "/>

Here is the interface for creating a new database server, enter the appropriate database server name, set your user name and password, and then click the OK button:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115146960-113184755. PNG "style=" border:0px; "/>

Then went back to the creation of the database interface, at this time the database server has been set up, just enter the name of the database can be. Then click the OK button to proceed to the next step:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115157429-618142149. PNG "style=" border:0px; "/>

Here's how to add the database configuration, directly click the Create button to complete the creation of all configurations:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115208585-1797550151. PNG "style=" border:0px; "/>

At this point, we've completed the creation of Azure Web App and cloud database. Next look at how we publish the ASP. NET Core app to Azure Web app.

Deploying ASP. NET Core Applications

After the creation of Azure Web App is complete, we go back to the deployment process. In the Connection tab, in fact, we see the settings are the default values, there is no special requirement, there is no need to modify. Click to enter the Settings tab:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115223616-841797857. PNG "style=" border:0px; "/>

The basic configuration uses the default values to do so. We need to choose the connection string to use the database, and Apply this migration on publish. Then click the Publish button to complete the release to the cloud:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115256866-1455856388. PNG "style=" border:0px; "/>

Depending on your network situation, the publishing process may last for a little while. When the release is complete, you can view the app in the browser.

a simple test

Our app has a very important function: You can create a user and log in. After the release, you must be very interested in testing this feature because we have not done anything to create this feature.

Below try to create a new user [email protected]:

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/139239/201612/139239-20161208115307585-311359710. PNG "width=" 728 "height=" 493 "style=" border:0px; "/>

Well, after the creation, the user [email protected] has successfully logged in.

Summary

This article describes the process of creating an ASP. NET Core app and deploying it to Azure Web app Service with detailed steps.

I hope to be of interest to the students have some help.


This article is from the "Grape City Control Technology Team Blog" blog, declined to reprint!

Azure deployment ASP. NET Core Web App

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: info-contact@alibabacloud.com 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.