App Service 概觀App Service overview

Azure App Service 是 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.

App Service 不只能將 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 功能,例如從 Azure DevOps、GitHub、Docker Hub 和其他來源進行持續部署、套件管理、預備環境、自訂網域和 TLS/SSL 憑證。You can also take advantage of its DevOps capabilities, such as continuous deployment from Azure DevOps, GitHub, Docker Hub, and other sources, package management, staging environments, custom domain, and TLS/SSL certificates.

在使用 App Service 時,您只需就您所使用的 Azure 計算資源支付費用。With App Service, you pay for the Azure compute resources you use. 您所使用的計算資源取決於您用來執行應用程式的 App Service 方案The compute resources you use are determined by the App Service plan that you run your apps on. 如需詳細資訊,請參閱 Azure App Service 方案概觀For more information, see Azure App Service plans overview.

為何要使用 App Service?Why use App Service?

以下是 App Service 的一些主要功能︰Here are some key features of App Service:

  • 多種語言和架構 - 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.
  • 受控的實際執行環境 - App Service 會自動為您 修補及維護 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.
  • 容器化和 Docker - 將您的應用程式 Docker 化,並在 App Service 中裝載自訂的 Windows 或 Linux 容器。Containerization and Docker - Dockerize your app and host a custom Windows or Linux container in App Service. 使用 Docker Compose 執行多容器應用程式。Run multi-container apps with Docker Compose. 將您的 Docker 技能直接遷移到 App Service。Migrate your Docker skills directly to App Service.
  • DevOps 最佳化 - 使用 Azure DevOps、GitHub、BitBucket、Docker Hub 或 Azure Container Registry 設定 持續整合和部署DevOps optimization - Set up continuous integration and deployment with Azure DevOps, GitHub, BitBucket, Docker Hub, or Azure Container Registry. 透過 測試和預備環境升級更新。Promote updates through test and staging environments. 使用 Azure PowerShell跨平台命令列介面 (CLI),在 App Service 中管理您的應用程式。Manage your apps in App Service by using Azure PowerShell or the cross-platform command-line interface (CLI).
  • 具高可用性的全域調整 - 以手動或自動方式相應 增加放大Global scale with high availability - Scale up or out manually or automatically. 在 Microsoft 的通用資料中心基礎結構中隨處裝載您的應用程式,而 App Service SLA 會承諾高可用性。Host your apps anywhere in Microsoft's global datacenter infrastructure, and the App Service SLA promises high availability.
  • SaaS 平台和內部部署資料的連線 - 有超過 50 種適用於企業系統 (例如 SAP)、SaaS 服務 (例如 Salesforce) 和網際網路服務 (例如 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.
  • 安全性和法規遵循 - App Service 為 ISO、SOC 和 PCI 相容Security and compliance - App Service is ISO, SOC, and PCI compliant. 使用 Azure Active DirectoryGoogleFacebookTwitterMicrosoft 帳戶來驗證使用者。Authenticate users with Azure Active Directory, Google, Facebook, Twitter, or Microsoft account. 建立 IP 位址限制管理服務身分識別Create IP address restrictions and manage service identities.
  • 應用程式範本 - 從 Azure Marketplace 中的廣泛應用程式範本清單中進行選擇,例如 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 和行動功能 - App Service 可提供適用於 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).

除了 App Service,Azure 還提供可用來裝載網站和 Web 應用程式的其他服務。Besides App Service, Azure offers other services that can be used for hosting websites and web applications. 在大部分的情況下,App Service 是最佳選擇。For most scenarios, App Service is the best choice. 若是微服務架構,請考慮使用 Azure Spring 雲端服務Service 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 App Service、虛擬機器、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 ServiceApp Service on Linux

App Service 也可以針對支援的應用程式堆疊,在 Linux 上以原生方式裝載 Web 應用程式。App Service can also host web apps natively on Linux for supported application stacks. 其也可以執行自訂的 Linux 容器 (也稱為用於容器的 Web App)。It can also run custom Linux containers (also known as Web App for Containers).

內建語言和架構Built-in languages and frameworks

Linux 上的 App Service 支援許多語言特定的內建映像。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.

已過期的執行階段會從入口網站中的 Web 應用程式 [建立] 和 [設定] 刀鋒視窗定期移除。Outdated runtimes are periodically removed from the Web Apps Create and Configuration blades in the Portal. 這些執行階段在維護組織淘汰或發現有重大弱點時,會從入口網站中隱藏。These runtimes are hidden from the Portal when they are deprecated by the maintaining organization or found to have significant vulnerabilities. 這些選項都是隱藏的,以將客戶引導至最成功的最新執行階段。These options are hidden to guide customers to the latest runtimes where they will be the most successful.

從入口網站中隱藏過期的執行階段時,使用該版本的任何現有網站都會繼續執行。When an outdated runtime is hidden from the Portal, any of your existing sites using that version will continue to run. 如果執行階段已從 App Service 平台完全移除,您的 Azure 訂用帳戶擁有者將會在移除之前收到電子郵件通知。If a runtime is fully removed from the App Service platform, your Azure subscription owner(s) will receive an email notice before the removal.

如果您需要使用已過期的執行階段版本 (不再顯示在入口網站上) 來建立另一個 Web 應用程式,請參閱語言設定指南,以取得如何取得網站執行階段版本的指示。If you need to create another web app with an outdated runtime version that is no longer shown on the Portal see the language configuration guides for instructions on how to get the runtime version of your site. 您可以使用 Azure CLI,以相同的執行階段建立另一個網站。You can use the Azure CLI to create another site with the same runtime. 或者,您可以使用入口網站中 Web 應用程式刀鋒視窗上的 [匯出範本] 按鈕,匯出網站的 ARM 範本。Alternatively, you can use the Export Template button on the web app blade in the Portal to export an ARM template of the site. 您可以重複使用此範本來部署具有相同執行時間和設定的新網站。You can reuse this template to deploy a new site with the same runtime and configuration.

限制Limitations

  • 共用定價層不支援 Linux 上的 App Service。App Service on Linux is not supported on Shared pricing tier.
  • 您無法在相同的 App Service 方案中混合使用 Windows 和 Linux 應用程式。You can't mix Windows and Linux apps in the same App Service plan.
  • 在過去,您無法在相同的資源群組中混合使用 Windows 和 Linux 應用程式。Historically, you can't mix Windows and Linux apps in the same resource group. 不過,在2021年1月21日或之後建立的所有資源群組都支援此案例。However, all resource groups created on or after January 21, 2021 do support this scenario. 針對在2021年1月21日之前建立的資源群組,新增混合平臺部署的功能將會在 Azure 區域中推出, (包括全國雲端區域) 很快。For resource groups created before January 21, 2021, the ability to add mixed platform deployments will be rolled out across Azure regions (including National cloud regions) soon.
  • 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.