在 Azure Web 應用程式中建立 .NET 應用程式

來源:互聯網
上載者:User

標籤:environ   source   man   type   dbf   帳戶   驗證   協助   ted   

本快速入門協助你在數分鐘內將你的第一個 ASP.NET Web 應用程式部署到 Azure 應用服務。完成本教程後,你將能夠在雲中啟動並運行一個簡單的 Web 應用程式。在本教程中完成的所有操作均符合 1 元試用條件。

開始之前

本教程示範如何使用 Visual Studio 2017 構建 ASP.NET Web 應用程式並將其部署到 Azure。 如果尚未安裝 Visual Studio 2017,可以下載並使用免費的 Visual Studio 2017 Community Edition。 在安裝 Visual Studio 的過程中,請確保啟用“Azure 開發”。如果沒有 Azure 訂閱,可在開始前建立一個試用帳戶。

 

步驟1:配置VS 2017 串連中國區 Azure

1. 建立一個 JSON 檔案 AadProvider.Configuration.json,檔案內容如下:

{
"AuthenticationQueryParameters": null,
"AsmEndPoint": "https://management.core.chinacloudapi.cn",
"Authority": "https://login.chinacloudapi.cn/",
"AzureResourceManagementEndpoint": "https://management.chinacloudapi.cn/",
"AzureResourceManagementAudienceEndpoints": [ "https://management.core.chinacloudapi.cn/" ],
"ClientIdentifier": "872cd9fa-d31f-45e0-9eab-6e460a02d1f1",
"EnvironmentName": "Mooncake",
"GraphEndpoint": "https://graph.chinacloudapi.cn",
"MsaHomeTenantId": "f577cd82-810c-43f9-a1f6-0cc532871050",
"NativeClientRedirect": "urn:ietf:wg:oauth:2.0:oob",
"PortalEndpoint": "http://manage.windowsazure.cn",
"ResourceEndpoint": "https://management.core.chinacloudapi.cn/",
"ValidateAuthority": true,
"VisualStudioOnlineEndpoint": "https://app.vssps.visualstudio.com/",
"VisualStudioOnlineAudience": "499b84ac-1321-427f-aa17-267ca6975798"
}

2. 串連到中國區 Azure 服務

a. 確保已登出並關閉 Visual Studio。

b. 刪除 %temp%\servicehub 檔案夾(詳細路徑為 C:\Users\%USERPROFILE%\AppData\Local\Temp\servicehub)。

c. 把前面建立的 JSON 檔案 (AadProvider.Configuration.json) 拷貝到 %localappdata%\.IdentityService\AadConfigurations(詳細路徑為 C:\Users\%USERPROFILE%\AppData\Local\.IdentityService\AadConfigurations, AadConfigurations 檔案夾可能不存在,需要手動建立)。 

d. 重啟 VS 並添加中國 Azure 賬戶即可。

3. 在Cloud Explorer中添加中國區 Azure 賬戶  

4. 點擊 Apply後即可在 Cloud Explorer中查看訂閱中的資源

步驟2:建立 ASP.NET Web 應用程式

1. 在 Visual Studio 中,使用 Ctrl+Shift+N 建立新項目。

2. 在“建立項目”對話方塊中,單擊“Visual C#”>“Web”>“ASP.NET Web 應用程式(.NET Framework)”。

3. 將應用程式命名為 myFirstAzureWebApp,然後單擊“確定”。 

4. 可將任何類型的 ASP.NET Web 應用程式部署到 Azure。 在本教程中,請選擇“MVC”模板,並確保將身分識別驗證設定為“無身分識別驗證”。單擊 “確定”。 

步驟3:發布到 Azure

1. 在“方案總管”中按右鍵“myFirstAzureWebApp”項目,然後選擇“發布”。 

2. 確保已選擇“Azure 應用服務”,然後單擊“發布”。 

3. 此時將開啟“建立應用服務”對話方塊,協助你建立所需的所有 Azure 資源,以便在 Azure 中運行 ASP.NET Web 應用程式。輸入您想要Web 應用程式名稱,選擇訂閱,建立資源群組,選擇應用計劃,詳細參數介紹請參考此處。最後點擊建立。

4. 建立完成後會自動將 ASP.NET Web 應用程式發布到 Azure(首次發布),然後在預設瀏覽器中啟動發布的 Azure Web 應用程式。

  

 

更多步驟 請即刻點擊前往

歡迎交流

A究院研究生 [email protected]

在 Azure Web 應用程式中建立 .NET 應用程式

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.