使用 Visual Studio“发布 Azure 应用程序”向导 | Microsoft DocsUsing the Visual Studio Publish Azure Application Wizard

在 Visual Studio 中开发 Web 应用程序后,可以使用发布 Azure 应用程序向导将该应用程序发布到 Azure 云服务。After you develop a web application in Visual Studio, you can publish that application to an Azure cloud service by using the Publish Azure Application wizard.

备注

本文是关于如何部署到云服务,而不是部署到网站。This article is about deploying to cloud services, not to web sites. 有关部署到网站的信息,请参阅如何部署 Azure 网站For information about deploying to web sites, see How to Deploy an Azure Web Site.

访问“发布 Azure 应用程序”向导Accessing the Publish Azure Application wizard

可以通过两种方式访问“发布 Azure 应用程序”向导,具体取决于所使用的 Visual Studio 项目类型。You can access the Publish Azure Application wizard in two ways depending on the type of Visual Studio project you have.

如果使用的是 Azure 云服务项目:If you have an Azure cloud service project:

  1. 在 Visual Studio 中创建或打开 Azure 云服务项目。Create or open an Azure cloud service project in Visual Studio.

  2. 在“解决方案资源管理器”中右键单击项目,并从上下文菜单中选择“发布”********。In Solution Explorer, right-click the project, and, from the context menu, select Publish.

如果使用的是未为 Azure 启用的 Web 应用程序项目:If you have a web application project that is not enabled for Azure:

  1. 在 Visual Studio 中创建或打开 Azure 云服务项目。Create or open an Azure cloud service project in Visual Studio.

  2. 在“解决方案资源管理器”**** 中右键单击项目,并从上下文菜单中选择“转换”**** > “转换为 Azure 云服务项目”****。In Solution Explorer, right-click the project, and, from the context menu, select Convert > Convert to Azure Cloud Service Project.

  3. 在“解决方案资源管理器”中右键单击新创建的 Azure 项目,并从上下文菜单中选择“发布”********。In Solution Explorer, right-click the newly created Azure project, and, from the context menu, select Publish.

登录页Sign-in page

登录页

帐户 - 选择一个帐户,或者在帐户下拉列表中选择“添加帐户”****。Account - Select an account or select Add an account in the account dropdown list.

选择订阅 - 选择要用于部署的订阅。Choose your subscription - Choose the subscription to use for your deployment.

“设置”页 -“常用设置”选项卡Settings page - Common Settings tab

通用设置

云服务 - 使用下拉列表选择现有的云服务,或者选择“<新建>”**** 创建一个云服务。Cloud service - Using the dropdown, either select an existing cloud service, or select <Create New>, and create a cloud service. 每个云服务的数据中心均显示在括号中。The data center displays in parentheses for each cloud service. 建议云服务的数据中心位置与存储帐户的数据中心位置相同(高级设置)。It is recommended that the data center location for the cloud service be the same as the data center location for the storage account (Advanced Settings).

环境 - 选择“生产”**** 或“过渡”****。Environment - Select either Production or Staging. 如果要在测试环境中部署应用程序,请选择过渡环境。Choose the staging environment if you want to deploy your application in a test environment.

生成配置 - 选择“调试”或“发布”。********Build configuration - Select either Debug or Release.

服务配置 - 选择“云”或“本地”。********Service configuration - Select either Cloud or Local.

为所有角色启用远程桌面 - 如果希望能够远程连接到服务,请选中此选项。Enable Remote Desktop for all roles - Select this option if you want to be able to remotely connect to the service. 此选项主要用于故障排除。This option is primarily used for troubleshooting. 有关详细信息,请参阅使用 Visual Studio 为 Azure 云服务中的角色启用远程桌面连接For more information, see Enable Remote Desktop Connection for a Role in Azure Cloud Services using Visual Studio.

为所有 Web 角色启用 Web 部署 - 选中此选项为服务启用 Web 部署。Enable Web Deploy for all web roles - Select this option to enable web deployment for the service. 还必须选择“为所有角色启用远程桌面”**** 选项才能使用此功能。You must also select the Enable Remote Desktop for all roles option to use this feature. 有关详细信息,请参阅使用 Visual Studio 发布云服务For more information, see Publishing a cloud service using Visual Studio.

“设置”页 -“高级设置”选项卡Settings page - Advanced Settings tab

高级设置

部署标签 - 接受默认名称,或者输入所选的名称。Deployment label - Either accept the default name, or enter a name of your choosing. 要将日期附加到部署标签,请保留选中相应的复选框。To append the date to the deployment label, leave the check box selected.

存储帐户 - 选择要用于此部署的存储帐户,或者单击“<新建>”创建一个存储帐户。Storage account - Select the storage account to use for this deployment, **<Create New> to create a storage account. 每个存储帐户的数据中心均显示在括号中。The data center displays in parentheses for each storage account. 建议存储帐户的数据中心位置与云服务的数据中心位置相同(常用设置)。It is recommended that the data center location for the storage account is the same as the data center location for the cloud service (Common Settings).

Azure 存储帐户将存储应用程序部署的包。The Azure storage account stores the package for the application deployment. 部署应用程序之后,将从存储帐户中删除该包。After the application is deployed, the package is removed from the storage account.

失败时删除部署 - 选择此选项可在发布期间遇到任何错误时会部署删除。Delete deployment on failure - Select this option to have the deployment deleted if any errors are encountered during publishing. 如果要保留云服务的不变虚拟 IP 地址,则应取消选中此项。This should be unchecked if you want to maintain a constant virtual IP address for your cloud service.

部署更新 - 如果希望仅部署更新的组件,请选择此选项。Deployment update - Select this option if you want to deploy only updated components. 这种部署类型比完整部署更快速。This type of deployment can be faster than a full deployment. 如果要保留云服务的不变虚拟 IP 地址,则应选中此项。This should be checked if you want to maintain a constant virtual IP address for your cloud service.

部署更新 - 设置 - 此对话框用于进一步指定要更新角色的方式。Deployment update - settings - This dialog is used to further specify how you want the roles to be updated. 如果选择“增量更新”****,则会一个接一个地更新应用程序的每个实例,以使应用程序始终可用。If you choose Incremental update, each instance of your application is updated one after another, so that the application is always available. 如果选择“同时更新”****,则会同时更新应用程序的所有实例。If you choose Simultaneous update, all instances of your application are updated at the same time. 同时更新速度更快,但在更新过程中服务可能不可用。Simultaneous updating is faster, but your service might not be available during the update process.

部署设置

启用 IntelliTrace - 指定是否要启用 IntelliTrace。Enable IntelliTrace - Specify if you want to enable IntelliTrace. 通过 IntelliTrace,可以在某个角色实例在 Azure 中运行时记录该角色实例的大量调试信息。With IntelliTrace, you can log extensive debugging information for a role instance when it runs in Azure. 如果需要查找问题的原因,可以从 Visual Studio 使用 IntelliTrace 日志来单步执行代码,就像它在 Azure 中运行一样。If you need to find the cause of a problem, you can use the IntelliTrace logs to step through your code from Visual Studio as if it were running in Azure. 有关使用 IntelliTrace 的详细信息,请参阅使用 Visual Studio 和 IntelliTrace 调试已发布的 Azure 云服务For more information about using IntelliTrace, see Debugging a published Azure cloud service with Visual Studio and IntelliTrace.

启用分析 - 指定是否要启用性能分析。Enable profiling - Specify if you want to enable performance profiling. 使用 Visual Studio 探查器,可以获取云服务在计算方面运行情况的深入分析。The Visual Studio profiler enables you to get an in-depth analysis of the computational aspects of how your cloud service runs. 有关使用 Visual Studio 探查器的详细信息,请参阅测试 Azure 云服务的性能For more information on using the Visual Studio profiler, see Test the performance of an Azure cloud service.

为所有角色启用远程调试器 - 指定是否要启用远程调试。Enable Remote Debugger for all roles - Specify if you want to enable remote debugging. 有关使用 Visual Studio 调试云服务的详细信息,请参阅在 Visual Studio 中调试 Azure 云服务或虚拟机For more information on debugging cloud services using Visual Studio, see Debugging an Azure cloud service or virtual machine in Visual Studio.

“诊断设置”页Diagnostics Settings page

诊断设置

通过诊断,可以对 Azure 云服务(或 Azure 虚拟机)进行故障排除。Diagnostics enables you to troubleshoot an Azure cloud service (or Azure virtual machine). 有关诊断的详细信息,请参阅 Configuring Diagnostics for Azure Cloud Services and Virtual Machines(为 Azure 云服务和虚拟机配置诊断)。For information about diagnostics, see Configuring Diagnostics for Azure Cloud Services and Virtual Machines. 有关 Application Insights 的信息,请参阅什么是 Application Insights?For information about Application Insights, see What is Application Insights?.

“摘要”页Summary page

总结

目标配置文件 - 可以选择基于所选的设置创建发布配置文件。Target profile - You can choose to create a publishing profile from the settings that you have chosen. 例如,可以创建一个配置文件用于测试环境,并创建另一个配置文件用于生产环境。For example, you might create one profile for a test environment and another for production. 要保存此配置文件,请选择 “保存” 图标。To save this profile, choose the Save icon. 向导将创建配置文件并将它保存在 Visual Studio 项目中。The wizard creates the profile and saves it in the Visual Studio project. 要修改配置文件名称,请打开目标配置文件列表,然后选择**<"管理...">**.To modify the profile name, open the Target profile list, and then choose <Manage…>.

备注

发布配置文件将出现在 Visual Studio 的解决方案资源管理器中,配置文件设置将写入扩展名为.azurePubxml 的文件。The publishing profile appears in Solution Explorer in Visual Studio, and the profile settings are written to a file with an .azurePubxml extension. 设置将保存为 XML 标记的属性。Settings are saved as attributes of XML tags.

发布应用程序Publishing your application

配置项目部署的所有设置后,请选择对话框底部的“发布”****。Once you configure all the settings for your project's deployment, select Publish at the bottom of the dialog. 你可以在 Visual Studio 的 “输出” 窗口中监视进程状态。You can monitor the process status in the Output window in Visual Studio.

后续步骤Next steps