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