Azure 中 Web 应用的部署常见问题解答Deployment FAQs for Web Apps in Azure

本文对 Azure 应用服务 Web 应用功能的部署相关常见问题 (FAQ) 进行了解答。This article has answers to frequently asked questions (FAQs) about deployment issues for the Web Apps feature of Azure App Service.

如果本文未解决你的 Azure 问题,请访问 MSDN 和 CSDN 上的 Azure 论坛。If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and CSDN. 可以在这些论坛上发布问题。You can post your issue in these forums. 还可提交 Azure 支持请求。You also can submit an Azure support request. 若要提交支持请求,请在 Azure 支持页上提交。To submit a support request, on the Azure support page.

我刚开始使用应用服务 Web 应用。I am just getting started with App Service web apps. 如何发布代码?How do I publish my code?

可通过以下几种方式发布 Web 应用代码:Here are some options for publishing your web app code:

  • 使用 Visual Studio 进行部署。Deploy by using Visual Studio. 如果具有 Visual Studio 解决方案,则右键单击 Web 应用程序项目,然后选择“发布” 。If you have the Visual Studio solution, right-click the web application project, and then select Publish.
  • 使用 FTP 客户端进行部署。Deploy by using an FTP client. 在 Azure 门户中,下载要向其部署代码的 Web 应用的发布配置文件。In the Azure portal, download the publish profile for the web app that you want to deploy your code to. 然后,使用相同的发布配置文件 FTP 凭据将文件上传到 \site\wwwroot。Then, upload the files to \site\wwwroot by using the same publish profile FTP credentials.

有关详细信息,请参阅将应用部署到应用服务For more information, see Deploy your app to App Service.

尝试从 Visual Studio 进行部署时,收到了一条错误消息。I see an error message when I try to deploy from Visual Studio. 如何解决此错误?How do I resolve this error?

如果看到以下消息,则可能使用的是旧版本的 SDK:“在资源组 'YourResourceGroup' 中部署资源 'YourResourceName' 时出错: MissingRegistrationForLocation: 未为‘中国北部’位置中的资源类型‘组件’注册订阅。请重新注册此提供程序,以便访问该位置。”If you see the following message, you might be using an older version of the SDK: “Error during deployment for resource 'YourResourceName' in resource group 'YourResourceGroup': MissingRegistrationForLocation: The subscription is not registered for the resource type 'components' in the location 'China North'.Re-register for this provider in order to have access to this location.”

若要解决此错误,请升级到最新 SDKTo resolve this error, upgrade to the latest SDK. 如果使用的是最新 SDK 但也收到了此消息,请提交支持请求。If you see this message and you have the latest SDK, submit a support request.

如何将 ASP.NET 应用程序从 Visual Studio 部署到应用服务?How do I deploy an ASP.NET application from Visual Studio to App Service?

教程五分钟内在 Azure 中创建第一个 ASP.NET Web 应用演示如何使用 Visual Studio 将 ASP.NET Web 应用程序部署到应用服务中的 Web 应用。The tutorial Create your first ASP.NET web app in Azure in five minutes shows you how to deploy an ASP.NET web application to a web app in App Service by using Visual Studio.

有哪些不同类型的部署凭据?What are the different types of deployment credentials?

应用服务支持两种类型的凭据,分别适用于本地 GIT 部署和 FTP/S 部署。App Service supports two types of credentials for local Git deployment and FTP/S deployment. 有关如何配置部署凭据的详细信息,请参阅为 Azure 应用服务配置部署凭据For more information about how to configure deployment credentials, see Configure deployment credentials for App Service.

应用服务 Web 应用中采用怎样的文件或目录结构?What is the file or directory structure of my App Service web app?

有应用服务应用的文件结构信息,请参阅 File structure in Azure(Azure 中的文件结构)。For information about the file structure of your App Service app, see File structure in Azure.

尝试通过 FTP 传输文件时出现“FTP 错误 550 - 磁盘空间不足”,应如何解决?How do I resolve "FTP Error 550 - There is not enough space on the disk" when I try to FTP my files?

如果看到此消息,磁盘空间可能即将达到 Web 应用服务计划中的磁盘配额。If you see this message, it's likely that you're running into a disk quota in the service plan for your web app. 可能需要基于磁盘空间需求提升到较高服务层级。You might need to scale up to a higher service tier based on your disk space needs. 有关定价计划和资源限制的详细信息,请参阅应用服务定价For more information about pricing plans and resource limits, see App Service pricing.

无法通过 FTP 传输到我的站点并发布代码。I can't FTP to my site and publish my code. 如何解决此问题?How do I resolve this issue?

若要解决 FTP 问题,请执行以下步骤:To resolve FTP issues:

  1. 验证是否输入了正确的主机名和凭据。Verify that you're entering the correct host name and credentials. 有关不同类型的凭据及其使用方法的详细信息,请参阅 Deployment credentials(部署凭据)。For detailed information about different types of credentials and how to use them, see Deployment credentials.
  2. 验证防火墙是否阻止了 FTP 端口。Verify that the FTP ports are not blocked by a firewall. 端口应具有以下设置:The ports should have these settings:
    • FTP 控制连接端口:21FTP control connection port: 21
    • FTP 数据连接端口:989、10001-10300FTP data connection port: 989, 10001-10300

如何将代码发布到应用服务?How do I publish my code to App Service?

Azure 快速入门旨在帮助用户使用所选的部署堆栈和方法部署应用。The Azure Quickstart is designed to help you deploy your app by using the deployment stack and method of your choice. 若要使用快速入门,请在 Azure 门户中转到应用服务,在“部署” 下,选择“快速入门” 。To use the Quickstart, in the Azure portal, go to your app service, under Deployment, select Quickstart.

为什么应用有时会在部署到应用服务后重启?Why does my app sometimes restart after deployment to App Service?

若要了解应用程序部署在哪些情况下可能导致重启,请参阅 Deployment vs. runtime issues(部署与运行时问题)。To learn about the circumstances under which an application deployment might result in a restart, see Deployment vs. runtime issues. 如本文所述,应用服务将文件部署到 wwwroot 文件夹。As the article describes, App Service deploys files to the wwwroot folder. 这决不会直接重启应用。It never directly restarts your app.

如何使用 FTP 或 FTPS 将应用部署到应用服务?How do I use FTP or FTPS to deploy my app to App Service?

有关如何使用 FTP 或 FTPS 将 Web 应用部署到应用服务的信息,请参阅使用 FTP/S 将应用部署到应用服务For information about using FTP or FTPS to deploy your web app to App Service, see Deploy your app to App Service by using FTP/S.