- Create an ASP.NET Core web app
- Publish to Azure
- Update the app and redeploy
- Manage the Azure web app
1. Create an ASP.NET Core web app
สร้างโปรเจ็กส์ web app ใหม่ File > New > Project
เลือก Visual C# > Web > ASP.NET Core Web Application
ตั้งชื่อ JackWebApp
เลือก Web Application แบบ No Authentication
ทดลองรัน Debug > Start without Debugging
จะได้ http://localhost:65153/
ให้สังเกตุมุมบนซ้ายจะมีเมนูแรกชื่อ JackWebApp
2. Publish to Azure
ที่ Solution Explorer ให้ right-click ที่โปรเจกส์ JackWebApp แล้วเลือก Publish
เลือก App Service และ Azure App Service เลือก Create New เสร็จแล้วกด Publish
จะเห็นหน้า Create App Service
โดยมี App Name ของเราเช่นชื่อ JackWebApp25610822115626
ที่ Hosting plan คลิก New.. จะปรากฏไดอะล็อก
เลือก Size ให้เป็นแบบ Free
ดูราคาของแต่ละแบบได้ที่ App Service pricing
คลิก Create
เป็นอันเสร็จ เราสามารถเข้า web app ของเราได้ตามรูปแบบนี้
[code]
http://<app_name>.azurewebsites.net
[/code]
เช่น http://JackWebApp25610822115626.azurewebsites.net
3. Update the app and redeploy
แก้ไขไฟล์ Pages/Index.cshtml
1 2 3 4 5 6 7 8 9 10 |
@page @model IndexModel @{ ViewData["Title"] = "Home page"; } <div class="jumbotron"> <h1>ASP.NET in Azure!</h1> <p class="lead">This is a simple app that we’ve built that demonstrates how to deploy a .NET app to Azure App Service.</p> </div> |
คลิกขวาที่โปรเจ็กส์ แล้วเลือก Publish …
คลิกปุ่ม Publish
เสร็จแล้วเรีกยเว็บใหม่ หน้าเว็บจะเปลี่ยนไปละตามที่เราแก้ไข
When publishing completes, Visual Studio launches a browser to the URL of the web app.
4. Manage the Azure web app
Go to the Azure portal to manage the web app.
ที่เมนูทางซ้ายเลือก App Services
คลิกเลือก Azure web app ที่เราสร้าง (JackWebApp25610822115626)
(ภาพนี้ตัดภาพมา ตัดเมนูซ้ายสุดที่เป็นแถบดำๆออก)
ทางด้านซ้ายแสดงหน้า config ของ web app เรา
Overview
Activity log
Access control (IAM)
Tags
Diagnose and solve problems
DEPLOYMENT
– Quickstart
– Deployment credentials
– Deployment slots
– Deployment options
– Deployment Center (Preview)
SETTINGS
– Application settings
– Authentication / Authorization
– Application Insights
– Managed service identity
– Backups
– Custom domains
– SSL settings
– Networking
– Scale up (App Service plan)
– Scale out (App Service plan)
– WebJobs
– Push
– MySQL In App
– Properties
– Locks
– Automation script
APP SERVICE PLAN
– App Service plan
– Quotas
– Change App Service plan
DEVELOPMENT TOOLS
– Clone app
– Console
– Advanced Tools
– App Service Editor (Preview)
– Performance test
– Resource explorer
– Testing in production
– Extensions
MOBILE
– Easy tables
– Easy APIs
– Data connections
API
– API definition
– CORS
MONITORING
– Alerts (Classic)
– Diagnostics logs
– Log stream
– Process explorer
SUPPORT + TROUBLESHOOTING
– Resource health
– App Service Advisor
– New support request
Link