Install .NET Core + Visual Studio toolinghtml
Verify your Azure account. You can open a free Azure account or Activate Visual Studio subscriber benefits.数据库
验证你的Azure帐号。你能够注册一个免费的Azure帐号也能够激活你的Visual Studio的Azure信用额度。浏览器
In the Visual Studio Start Page, tap New Project.... app
在Visual Studio启示页面,点击New Project… webapp
Alternatively, you can use the menus to create a new project. Tap File > New > Project.... 测试
你也能够经过菜单来建立一个新的项目。点击File > New > Project… this
Complete the New Project dialog: spa
完成新项目的建立 3d
In the left pane, tap Web
在左边面板,点击Web
In the center pane, tap ASP.NET Core Web Application (.NET Core)
在中间的面板,点击选择Asp.Net Core Web Application(.Net Core)
Tap OK
点击OK
In the New ASP.NET Core Web Application (.NET Core) dialog:
在New Asp.Net Core Web Application(.Net Core)对话框中:
Tap Web Application
点击Web Application
Verify Authentication is set to Individual User Accounts
Authentication设置成Individual User Accounts
Verify Host in the cloud is not checked
不选中Host in the Cloud
Tap OK
点击OK
Press Ctrl-F5 to run the app locally
按Ctrl+F5在本地运行应用
Tap the About and Contact links. Depending on the size of your device, you might need to tap the navigation icon to show the links
点击About和Contact连接,根据你设备分辨率的大小,你可能须要点击导航图标才能看到这些连接。
You can fix the problem in two different ways:
你能够使用如下两种方式修复问题:
Tap Apply Migrations and, once the page updates, refresh the page;
点击Apply Migrations,等待更新后,刷新页面
Run the following from a command prompt in the project's directory:
在命令终端下,到项目目录运行如下命令:
dotnet ef database update
The app displays the email used to register the new user and a Log off link.
刷新页面后,页面会显示咱们注册的新用户和看到一个Log off的连接。
Right-click on the project in Solution Explorer and select Publish....
在Solution Explorer右键项目,点击Publish
In the Publish dialog, tap Microsoft Azure App Service.
在Publish对话框中,点击Microsoft Azure App service.
Tap New... to create a new resource group. Creating a new resource group will make it easier to delete all the Azure resources you create in this tutorial.
点击New建立一个新的资源组。建立新的资源组能够方便你删除全部在Azure上建立的范例资源。
Create a new resource group and app service plan:
添加一个新的Resource group和app service plan:
Tap New... for the resource group and enter a name for the new resource group
在resource group点击New,而后为这个资源组取名
Tap New... for the app service plan and select a location near you. You can keep the default generated name
在app service plan点击New,选择一个
Tap Explore additional Azure services to create a new database
点击Explore additional Azure services去建立一个新的数据库
On the Settings stage of the Publish dialog:
点击Publish对话框的Settings标签
Expand Databases and check Use this connection string at runtime
扩展Databases,选中Use this connection string at runtime
Expand Entity Framework Migrations and check Apply this migration on publish
扩展Entity Framework Migrations,选中Apply this migration on publish
Tap Publish and wait until Visual Studio finishes publishing your app
点击Publish,等待Visual Studio完成发布你的应用。
Visual Studio will publish your app to Azure and launch the cloud app in your browser.
Visual Studio会在发布到Azure后经过浏览器打开你在云端部署的应用。
Test the About and Contact links
测试About和Contact连接
Register a new user
注册一个用户
Views/Home/About.cshtml
Razor view file and change its contents. For example: @{ ViewData["Title"] = "About"; } <h2>@ViewData["Title"].</h2> <h3>@ViewData["Message"]</h3> <p>My updated about page.</p>
When you have finished testing the app, go to the Azure portal and delete the app.
当你完成测试后,去Azure后台删除这个应用。
https://docs.microsoft.com/zh-cn/aspnet/core/tutorials/publish-to-azure-webapp-using-vs