当前位置: 首页>>代码示例>>C#>>正文


C# AzureService.ChangeServiceName方法代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.Management.Utilities.CloudService.AzureService.ChangeServiceName方法的典型用法代码示例。如果您正苦于以下问题:C# AzureService.ChangeServiceName方法的具体用法?C# AzureService.ChangeServiceName怎么用?C# AzureService.ChangeServiceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.WindowsAzure.Management.Utilities.CloudService.AzureService的用法示例。


在下文中一共展示了AzureService.ChangeServiceName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeSettingsAndCreatePackage

        /// <summary>
        /// Initialize our model of the AzureService located at the given
        /// path along with its DeploymentSettings and SubscriptionId.
        /// </summary>
        /// <param name="rootPath">Root path of the Azure service.</param>
        /// <param name="manifest">External runtime manifest to use, mainly for testing purposes</param>
        internal bool InitializeSettingsAndCreatePackage(string rootPath, string manifest = null)
        {
            Debug.Assert(!string.IsNullOrEmpty(rootPath), "rootPath cannot be null or empty.");
            Debug.Assert(Directory.Exists(rootPath), "rootPath does not exist.");

            _azureService = new AzureService(rootPath, null);

            // If user provided a service name, change current service name to use it.
            //
            if (!string.IsNullOrEmpty(ServiceName))
            {
                _azureService.ChangeServiceName(ServiceName, _azureService.Paths);
            }

            ServiceSettings defaultSettings = ServiceSettings.LoadDefault(
                _azureService.Paths.Settings,
                Slot,
                Location,
                AffinityGroup,
                Subscription,
                StorageAccountName,
                ServiceName,
                _azureService.ServiceName,
                out _hostedServiceName);

            if (!string.IsNullOrEmpty(defaultSettings.Subscription))
            {
                var globalComponents = GlobalComponents.Load(GlobalPathInfo.GlobalSettingsDirectory);
                CurrentSubscription = globalComponents.Subscriptions.Values.First(
                    subscription => subscription.SubscriptionName == defaultSettings.Subscription);
            }
            else
            {
                defaultSettings.Subscription = CurrentSubscription.SubscriptionName;
            }

            WriteVerboseWithTimestamp(String.Format(Resources.RuntimeDeploymentStart,
                _hostedServiceName));
            if (PrepareRuntimeDeploymentInfo(_azureService, defaultSettings, manifest))
            {

                WriteVerboseWithTimestamp(String.Format(Resources.PublishPreparingDeploymentMessage,
                    _hostedServiceName, CurrentSubscription.SubscriptionId));

                // Caching worker roles require update to their service configuration settings with
                // the storage service credentials. Before creating the package verify that the storage
                // service exists and fetch its credentials.
                if (!StorageAccountExists(defaultSettings.StorageAccountName))
                {
                    CreateStorageAccount(
                        defaultSettings.StorageAccountName,
                        _hostedServiceName,
                        defaultSettings.Location,
                        defaultSettings.AffinityGroup);
                }

                // Initiate call to all publish listeners.
                this._listeners.ForEach<IPublishListener>(l => l.OnPublish(Channel, _azureService, defaultSettings, CurrentSubscription.SubscriptionId));

                CreatePackage();

                _deploymentSettings = new DeploymentSettings(
                    defaultSettings,
                    _azureService.Paths.CloudPackage,
                    _azureService.Paths.CloudConfiguration,
                    _hostedServiceName,
                    string.Format(Resources.ServiceDeploymentName, defaultSettings.Slot));

                return true;
            }

            return false;
        }
开发者ID:bryanhunter,项目名称:azure-sdk-tools,代码行数:79,代码来源:PublishAzureServiceProject.cs

示例2: ChangeServiceNameTest

        public void ChangeServiceNameTest()
        {
            string newName = "NodeAppService";

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                AzureService service = new AzureService(files.RootPath, serviceName, null);
                service.ChangeServiceName(newName, service.Paths);
                Assert.AreEqual<string>(newName, service.Components.CloudConfig.serviceName);
                Assert.AreEqual<string>(newName, service.Components.LocalConfig.serviceName);
                Assert.AreEqual<string>(newName, service.Components.Definition.name);
            }
        }
开发者ID:shanmukrao,项目名称:azure-sdk-tools,代码行数:13,代码来源:AzureServiceTests.cs


注:本文中的Microsoft.WindowsAzure.Management.Utilities.CloudService.AzureService.ChangeServiceName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。