Linux 上的 Azure 应用服务常见问题解答Azure App Service on Linux FAQ

随着 Linux 应用服务的发布,我们正在努力添加功能和改进我们的平台。With the release of App Service on Linux, we're working on adding features and making improvements to our platform. 本文提供客户最近提出的问题的解答。This article provides answers to questions that our customers have been asking us recently.

如果你有问题,请对本文发表评论。If you have a question, comment on this article.

管理Management

在 Azure 门户中按下“重启”按钮时,会发生什么情况?What happens when I press the restart button in the Azure portal?

此操作等同于 Docker 重启。This action is the same as a Docker restart.

可以使用安全外壳 (SSH) 连接到应用容器虚拟机 (VM) 吗?Can I use Secure Shell (SSH) to connect to the app container virtual machine (VM)?

是的,可以通过源代码管理 (SCM) 站点实现此操作。Yes, you can do that through the source control management (SCM) site.

备注

还可以使用 SSH、SFTP 或 Visual Studio Code(用于实时调试 Node.js 应用)直接从本地开发计算机连接到应用容器。You can also connect to the app container directly from your local development machine using SSH, SFTP, or Visual Studio Code (for live debugging Node.js apps). 有关详细信息,请参阅远程调试和通过 SSH 登录到 Linux 上的应用服务For more information, see Remote debugging and SSH in App Service on Linux.

如何通过 SDK 或 Azure 资源管理器模板创建 Linux 应用服务计划?How can I create a Linux App Service plan through an SDK or an Azure Resource Manager template?

应将应用服务的“保留”字段设置为“true”。Set the reserved field of the app service to true.

持续集成和持续部署Continuous integration and deployment

是否支持过渡环境?Do you support staging environments?

是的。Yes.

是否可以使用 WebDeploy/MSDeploy 来部署 Web 应用?Can I use WebDeploy/MSDeploy to deploy my web app?

可以,需要将名为 WEBSITE_WEBDEPLOY_USE_SCM 的应用设置设置为 falseYes, you need to set an app setting called WEBSITE_WEBDEPLOY_USE_SCM to false.

使用 Linux Web 应用时,应用程序的 Git 部署失败。如何解决此问题?Git deployment of my application fails when using Linux web app. How can I work around the issue?

如果 Linux Web 应用的 Git 部署失败,可选择以下选项之一部署应用程序代码:If Git deployment fails to your Linux web app, choose one of the following options to deploy your application code:

  • 使用持续交付(预览版)功能:可将应用的源代码存储在 Azure DevOps Git 存储库或 GitHub 存储库中,以使用 Azure 持续交付。Use the Continuous Delivery (Preview) feature: You can store your app's source code in an Azure DevOps Git repo or GitHub repo to use Azure Continuous Delivery. 有关详细信息,请参阅如何为 Linux Web 应用配置持续交付For more information, see How to configure Continuous Delivery for Linux web app.

  • 使用 ZIP 部署 API:若要使用此 API,请通过 SSH 连接到 Web 应用,并转到要在其中部署代码的文件夹。Use the ZIP deploy API: To use this API, SSH into your web app and go to the folder where you want to deploy your code. 运行以下代码:Run the following code:

    curl -X POST -u <user> --data-binary @<zipfile> https://{your-sitename}.scm.chinacloudsites.cn/api/zipdeploy
    

    如果有错误指出找不到 curl 命令,请确保在运行前一条 curl 命令之前使用 apt-get install curl 安装 curl。If you get an error that the curl command is not found, make sure you install curl by using apt-get install curl before you run the previous curl command.

语言支持Language support

我想要在 Node.js 应用程序中使用 Web 套接字,要设置什么特殊设置或配置吗?I want to use web sockets in my Node.js application, any special settings, or configurations to set?

需要,请在服务器端 Node.js 代码中禁用 perMessageDeflateYes, disable perMessageDeflate in your server-side Node.js code. 例如,如果要使用 socket.io,请使用以下代码:For example, if you are using socket.io, use the following code:

const io = require('socket.io')(server,{
  perMessageDeflate :false
});

是否支持未编译的 .NET Core 应用?Do you support uncompiled .NET Core apps?

是的。Yes.

是否支持将 Composer 用作 PHP 应用的依赖关系管理器?Do you support Composer as a dependency manager for PHP apps?

支持,在 Git 部署过程中,Kudu 应检测到正在部署 PHP 应用程序(这得益于 composer.lock 文件的存在),然后触发 composer 安装。Yes, during a Git deployment, Kudu should detect that you're deploying a PHP application (thanks to the presence of a composer.lock file), and Kudu will then trigger a composer install.

Web 套接字Web Sockets

Linux 应用支持 Web 套接字。Web Sockets are supported on Linux apps.

重要

免费应用服务计划中的 Linux 应用目前不支持 Web 套接字。Web Sockets are not currently supported for Linux apps on Free App Service Plans. 我们正在努力消除此限制,并计划在免费应用计划中最多支持 5 个 Web 套接字连接。We are working on removing this limitation and plan to support up to 5 web socket connections on Free App Service plans.

定价和 SLAPricing and SLA

服务正式版的定价是多少?What is the pricing, now that the service is generally available?

定价因 SKU 和区域而异,但你可以在我们的定价页上查看更多详细信息:应用服务定价Pricing varies by SKU and region but you can see more details at our pricing page: App Service Pricing.

其他问题Other questions

“请求的功能在资源组中不可用”是什么意思?What does "Requested feature is not available in resource group" mean?

使用 Azure 资源管理器 (ARM) 创建 Web 应用时,你可能会看到此消息。You may see this message when creating web app using Azure Resource Manager (ARM). 根据当前的限制,对于同一资源组,不能在同一区域中混合使用 Windows 和 Linux 应用。Based on a current limitation, for the same resource group, you cannot mix Windows and Linux apps in the same region.

应用程序设置名称中支持的字符有哪些?What are the supported characters in application settings names?

应用程序设置只能使用字母(A-Z、a-z)、数字 (0-9) 和下划线字符 ()。You can use only letters (A-Z, a-z), numbers (0-9), and the underscore character () for application settings.

可在何处请求新功能?Where can I request new features?

可以在 Web 应用反馈论坛提交看法。You can submit your idea at the Web Apps feedback forum. 请将“[Linux]”添加到建议的标题中。Add "[Linux]" to the title of your idea.

后续步骤Next steps