简体   繁体   English

Azure Cloud Service部署而不更改现有配置

[英]Azure Cloud Service deployment without changing existing configuration

Is it possible to deploy a Cloud Service without changing existing configuration? 是否可以在不更改现有配置的情况下部署Cloud Service?

What i want to do is to deploy a Cloud Service package to the Dev Cloud Service and then take the same package and upload it to the Production Cloud Service. 我想要做的是将Cloud Service包部署到Dev Cloud Service,然后使用相同的包并将其上载到Production Cloud Service。

Any Ideas? 有任何想法吗?

If I understand the question correctly, yes this is possible. 如果我正确理解了这个问题,是的,这是可能的。 All the configuration settings that you'd like to be different between the two environments (like connection strings, app settings, etc.) should be defined in the Service Definition file and set in the service configuration file. 您希望在两个环境之间保持不同的所有配置设置(如连接字符串,应用程序设置等)应在服务定义文件中定义,并在服务配置文件中设置。 When Visual Studio uploads the package it uploads the package and service configuration file separately (the service definition is inside the package). 当Visual Studio上传程序包时,它会单独上载程序包和服务配置文件(服务定义在程序包内)。 When you do an update or deployment from the command line or from the portal you provide the package and service configuration file separately as well. 从命令行或从门户进行更新或部署时,也会单独提供程序包和服务配置文件。 This allows you to push the same package, but provide different configuration. 这允许您推送相同的包,但提供不同的配置。 If you don't have any differences between the deployments, which would be rare I would think, you just deploy the same package and configuration file. 如果您在部署之间没有任何差异(我认为这种情况很少见),您只需部署相同的程序包和配置文件即可。

If you are performing an update to the production system and you don't want to "override" the configuration that is already there for production you just need to upload the same file you previouly uploaded. 如果您正在对生产系统执行更新,并且您不想“覆盖”已经用于生产的配置,则只需上传您之前上传的相同文件。 This is why it is important to keep track of all your deployments over time, for rollback purposes or for something like this where you want to push up the same configuration as before. 这就是为什么随着时间的推移跟踪所有部署,出于回滚目的或者想要推送与以前相同的配置之类的事情的重要性。

The MSDN Documentation covers how to upload from the portal, which includes selecting the configuration file separately: https://www.windowsazure.com/en-us/manage/services/cloud-services/how-to-create-and-deploy-a-cloud-service/#deploy . MSDN文档介绍了如何从门户上传,其中包括单独选择配置文件: https//www.windowsazure.com/en-us/manage/services/cloud-services/how-to-create-and-deploy -a-cloud-service / #deploy You may also want to look at doing this via a command line tool like powerShell or the other Windows Azure CLI tools. 您可能还希望通过命令行工具(如powerShell或其他Windows Azure CLI工具)来执行此操作。

Note, that if you have settings that are in the web.config or app.config of a web role that must be different per environment, you will need to research a way to move those settings either into the service configuration or at runtime pull them for a specific location based on environment. 请注意,如果您的web.config或app.config中的设置属于每个环境必须不同的Web角色,则需要研究一种方法将这些设置移动到服务配置中或在运行时将它们拉出来针对基于环境的特定位置。

Rather late to this one: 这个晚了:

There is now a "Download" button on the "Configure" tab for your cloud service: 云服务的“配置”选项卡上现在有一个“下载”按钮: 在此输入图像描述

This will generate a ServiceConfiguration.cscfg file that contains the currently configured editable settings, as well as any non-editable settings that were originally included. 这将生成一个ServiceConfiguration.cscfg文件,其中包含当前配置的可编辑设置,以及最初包含的任何不可编辑的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM