注意:本文内容若有更新或补正,会更正到知识库:

https://www.yuque.com/seanyu/azure/appservice

 

概览

 

1.用来托管Web应用,移动后端及RESTful API;

2.Paas产品,无需用户管理基础结构;

3.自动缩放,高可用;

4.后端系统支持Windows 和Linux;

5.支持GitHub,Azure DevOps,Git存储库自动部署;

6.多语言:.NET, Node.js, PHP, Java, Python(Linux),HTML等

7.SLA 99.95%

 

与Azure 产品集成

1.自定义域名;

2.SSL保护;

3.CDN 支持;

 

 

案例一部署Node.js 站点

1. 下载安装Node.js

2. 准备Node.js测试网站

 

使用npm工具 npx直接运行如下命令:

 

npx express-generator myExpressApp --view pug --git

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享

然后执行:

cd myExpressApp
npm install

 

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_02

 

npm start

 

打开浏览器并导航到 http://localhost:3000,其中应会显示如下所示的内容

 

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_03

 

3.准备Visual Studio Code 开发环境

 

下载安装Visual Studio Code:https://code.visualstudio.com/

下载相关的扩展:

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_04

 

设置Azure 扩展为中国区Azure(如果使用世纪互联版本,则需要本步骤):

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_05

 

登录Azure 账号:

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_06

 

4. 在Azure创建Web App

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_07

 

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_08

 

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_09

 

 

5.发布Node.js 网站到Azure Web App

打开VS CODE,打开Node.js 网站项目

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_10

 

输入  (CTRL + SHIFT + P) 进行部署,方法是键入“deploy to web app”并运行“Azure App Service: Deploy to Web App”命令。

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_11

 

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_12

 

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_13

 

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_14

 

Azure App Service-多语言/高可用/自动缩放的Web托管服务(1)_经验分享_15

点击Browse Website 查看网站。