应用服务概述App Service overview

Azure 应用服务是一项基于 HTTP 的服务,用于托管 Web 应用程序、REST API 和移动后端 。Azure App Service is an HTTP-based service for hosting web applications, REST APIs, and mobile back ends. 可以使用 .NET、NET Core、Java、Ruby、Node.js、PHP 或 Python 等偏好的语言进行开发。You can develop in your favorite language, be it .NET, .NET Core, Java, Ruby, Node.js, PHP, or Python. 在基于 Windows 和 Linux 的环境中,应用程序都可以轻松地运行和缩放。Applications run and scale with ease on both Windows and Linux-based environments.

应用服务不仅可将 Microsoft Azure 的强大功能(例如安全性、负载均衡、自动缩放和自动管理)添加到应用程序。App Service not only adds the power of Microsoft Azure to your application, such as security, load balancing, autoscaling, and automated management. 还可以利用其 DevOps 功能,例如包管理、过渡环境、自定义域和 TLS/SSL 证书。You can also take advantage of its DevOps capabilities, such as package management, staging environments, custom domain, and TLS/SSL certificates.

使用应用服务时,需要支付 Azure 计算资源的使用费。With App Service, you pay for the Azure compute resources you use. 使用的计算资源量由运行应用的应用服务计划确定。The compute resources you use are determined by the App Service plan that you run your apps on. 有关详细信息,请参阅 Azure 应用服务计划概述For more information, see Azure App Service plans overview.

为何使用应用服务?Why use App Service?

下面是应用服务的一些主要功能:Here are some key features of App Service:

  • 多个语言和框架 - 应用服务针对 ASP.NET、ASP.NET Core、Java、Ruby、Node.js、PHP 或 Python 提供一流支持。Multiple languages and frameworks - App Service has first-class support for ASP.NET, ASP.NET Core, Java, Ruby, Node.js, PHP, or Python. 我们还能以后台服务的形式运行 PowerShell 和其他脚本或可执行文件You can also run PowerShell and other scripts or executables as background services.
  • 托管生产环境 - 应用服务会自动修补并维护 OS 和语言框架Managed production environment - App Service automatically patches and maintains the OS and language frameworks for you. 将时间花在编写优秀应用上,让 Azure 来考虑平台问题。Spend time writing great apps and let Azure worry about the platform.
  • 具有高可用性的全局缩放 - 以手动或自动方式进行增大扩大Global scale with high availability - Scale up or out manually or automatically. 在 Azure.cn 的全国数据中心基础结构中的任意位置托管应用,并且应用服务 SLA 承诺高可用性。Host your apps anywhere in Azure.cn's national datacenter infrastructure, and the App Service SLA promises high availability.
  • 与 SaaS 平台和本地数据建立连接 - 从适用于企业系统(例如 SAP)的 50 多个连接器、SaaS 服务(例如 Salesforce)以及 Internet 服务(例如 Facebook)中进行选择。Connections to SaaS platforms and on-premises data - Choose from more than 50 connectors for enterprise systems (such as SAP), SaaS services (such as Salesforce), and internet services (such as Facebook). 使用混合连接Azure 虚拟网络访问本地数据。Access on-premises data using Hybrid Connections and Azure Virtual Networks.
  • 安全性和合规性 - 应用服务符合 ISO、SOC 和 PCI的要求。Security and compliance - App Service is ISO, SOC, and PCI compliant. 使用 Azure Active DirectoryMicrosoft 帐户对用户进行身份验证。Authenticate users with Azure Active Directory or Microsoft account. 创建 IP 地址限制管理服务标识Create IP address restrictions and manage service identities.
  • 应用程序模板 - 从 Azure 市场的大量应用程序模板列表中进行选择,例如 WordPress、Joomla 和 Drupal。Application templates - Choose from an extensive list of application templates in the Azure Marketplace, such as WordPress, Joomla, and Drupal.
  • Visual Studio 与 Visual Studio Code 集成 - Visual Studio 和 Visual Studio Code 中的专用工具可简化创建、部署和调试工作。Visual Studio and Visual Studio Code integration - Dedicated tools in Visual Studio and Visual Studio Code streamline the work of creating, deploying, and debugging.
  • API 和移动功能 - 应用服务针对 RESTful API 方案提供统包式 CORS 支持,通过启用身份验证、脱机数据同步、推送通知等功能简化移动应用方案。API and mobile features - App Service provides turn-key CORS support for RESTful API scenarios, and simplifies mobile app scenarios by enabling authentication, offline data sync, push notifications, and more.
  • 无服务器代码 - 按需运行代码片段或脚本,无需显式预配或管理基础结构,并且只需为代码实际使用的计算时间付费(请参阅 Azure Functions)。Serverless code - Run a code snippet or script on-demand without having to explicitly provision or manage infrastructure, and pay only for the compute time your code actually uses (see Azure Functions).

除了应用服务,Azure 还提供可用来托管网站和 Web 应用程序的其他服务。Besides App Service, Azure offers other services that can be used for hosting websites and web applications. 大多数情况下,应用服务是最佳选择。For most scenarios, App Service is the best choice. 对于微服务体系结构,请考虑使用 Azure Spring-Cloud ServiceService FabricFor microservice architecture, consider Azure Spring-Cloud Service or Service Fabric. 如果需要更好地控制运行代码的 VM,请考虑使用 Azure 虚拟机If you need more control over the VMs on which your code runs, consider Azure Virtual Machines. 有关如何在这些 Azure 服务之间做出选择的详细信息,请参阅 Azure 应用服务、虚拟机、Service Fabric 和云服务的比较For more information about how to choose between these Azure services, see Azure App Service, Virtual Machines, Service Fabric, and Cloud Services comparison.

Linux 上的应用服务App Service on Linux

应用服务也可以在 Linux 上为支持的应用堆栈本地托管 Web 应用。App Service can also host web apps natively on Linux for supported application stacks. 它还可以运行自定义 Linux 容器(也称为用于容器的 Web 应用)。It can also run custom Linux containers (also known as Web App for Containers).

内置语言和框架Built-in languages and frameworks

Linux 上的应用服务支持许多特定于语言的内置映像。App Service on Linux supports a number of language specific built-in images. 只需部署代码。Just deploy your code. 支持的语言包括:Node.js、Java (JRE 8 & JRE 11)、PHP、Python、.NET Core 和 Ruby。Supported languages include: Node.js, Java (JRE 8 & JRE 11), PHP, Python, .NET Core and Ruby. 运行 az webapp list-runtimes --linux 查看最新语言和支持的版本。Run az webapp list-runtimes --linux to view the latest languages and supported versions. 如果内置映像中不支持应用程序所需的运行时,则可以使用自定义容器部署运行时。If the runtime your application requires is not supported in the built-in images, you can deploy it with a custom container.

限制Limitations

  • 共享定价层不支持 Linux 上的应用服务。App Service on Linux is not supported on Shared pricing tier.
  • 不能在同一个应用服务计划中混合使用 Windows 和 Linux 应用。You can't mix Windows and Linux apps in the same App Service plan.
  • 在同一资源组内,不能在同一区域中混合使用 Windows 和 Linux 应用。Within the same resource group, you can't mix Windows and Linux apps in the same region.
  • Azure 门户仅显示当前可用于 Linux 应用的功能。The Azure portal shows only features that currently work for Linux apps. 功能启用后,它们在门户上被激活。As features are enabled, they're activated on the portal.
  • 部署到内置映像时,代码和内容将被分配一个 Web 内容存储卷,由 Azure 存储提供支持。When deployed to built-in images, your code and content are allocated a storage volume for web content, backed by Azure Storage. 与容器文件系统的延迟相比,此卷的磁盘延迟更高,并且变化更大。The disk latency of this volume is higher and more variable than the latency of the container filesystem. 自定义容器选项将文件放在容器文件系统而非内容卷中,因此可能更适用于需要频繁以只读方式访问内容文件的应用。Apps that require heavy read-only access to content files may benefit from the custom container option, which places files in the container filesystem instead of on the content volume.

后续步骤Next steps

创建第一个 Web 应用。Create your first web app.