Azure Cloud Web Application
Original: Getting Started
Rick Anderson
Translation: Thumbelina (Kiler)
Proofreading: Meng Liang (book edge), Liu Yi (alexlewis), He-Shiodome
Setting up the development environment
- Install the latest version of Azure SDK for Visual Studio 2015. If you haven't installed Visual Studio 2015,SDK before, you'll install Visual Studio 2015.
Attention
If your machine has not been installed before any dependencies, the SDK installation time will be more than 30 minutes.
Create a WEB application
On the Start page of Visual Studio, click New Project.
Alternatively, you can create a new item from the menu. Click File > New > Project .
To complete the New Project dialog box:
- In the right panel, click Web
- In the central panel, click ASP. NET Core WEB Application
- Click OK
In the New ASP. NET Core WEB Application dialog box:
- Click WEB Application
- Confirm that authentication is set to individual User Accounts
- Verify that the Host in the cloud is not selected
- Click OK
Test your application locally
- To run a program using Ctrl F5
- Click on the about and contact links. Depending on the size of your device's display size, you may need to click the navigation icon to display the link
- Register A new user by clicking Register. You can use fictitious e-mail messages. When you click Submit, you will receive the following error:
There are two ways to fix this problem:
- Click Apply Migrations when the page has been updated, refresh the screen
- Run the command line under the project directory:
dotnet ef database update
The application displays the registered mailbox and the logout link used by the user when registering.
Publish Applications to Azure
Right-click the project selection Publish
In the Publish Pop-up dialog box, click Microsoft Azure App Service
Click New to enter a resource group. The purpose of creating a new resource group is to make it easy to remove all of the Azure resources that you created in this tutorial.
Create a new resource group and an app service plan:
- Click New to create a resource group and enter a name for the new resource group
- Click New to create an app service plan and select an address near you. You can keep the default generated name
- Click Explore Additional Azure services to create a new database
- Click the green + icon to create a SQL database
- In the Configure SQL Database Pop-up dialog box, click New
- You can keep the default Server Name
- Enter the administrator user password and click OK. Remember the user name password.
In the Configure SQL Database Pop-up dialog box, click OK
In the create App Service Pop-up dialog box, click Create
- In the Publish Pop-up dialog box, click Next
- The Settings link in the Publish Popup dialog box:
- Check Use this connection string at runtime
- Check Apply This migration on publish
Visual Studio will deploy your application to the Azure cloud and launch your cloud app in the browser.
Test your application in the Azure cloud
- Test about and contact links
- Register a new user
Update application
- Edit the views/home/about.cshtml Razor view file. Modify the content, for example:
@{ ViewData["Title"] = "About";}"Title"]."Message"]<p>My updated about page.</p>
- Right-click the project selection Publish
- Click Publish and verify your changes in the Azure cloud app.
Clean
If you have finished setting up your application, sign in to the Azure panel and delete the app.
- Sign in to the Azure panel
- Double-click Resource groups on the right and click the resource group you created.
Next
- Getting started with ASP. NET Core MVC and Visual Studio
- Introduction to ASP.
- Principle
Back to Catalog
Azure Cloud Web Application