【问题标题】:Set-AzureDeployment - ProtocolException设置 AzureDeployment - ProtocolException
【发布时间】:2012-11-09 18:03:11
【问题描述】:

安装 Windows Azure Powershell(2012 年 10 月版本 0.6.7)后,我收到运行 Set-AzureDeployment Cmdlet 的错误。

为 Remove-AzureDeployment 和 New-AzureDeployment 提供相同的参数可以正常工作。

Remove-AzureDeployment -Slot $slot -ServiceName $serviceName -Force

New-AzureDeployment -Slot $slot -Package $packageLocation -Configuration $cloudConfigLocation -label $deploymentLabel -ServiceName $serviceName

但是,当使用带有 -Upgrade 开关和相同参数值的 Set-AzureDeployment 时,我得到一个错误。

Set-AzureDeployment -Upgrade -Slot $slot -Package $packageLocation -Configuration $cloudConfigLocation -label $deploymentLabel -ServiceName $serviceName -Force

错误是:

+ CategoryInfo : CloseError: (:) [Set-AzureDeployment], ProtocolException

+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.SetAzureDeploymentCommand

捕捉内部异常显示:

<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>MissingOrIncorrectVersionHeader</Code><Message>The versioning header is not specified or was specified incorrectly.</Message></Error>

任何人都可以就可能出现的问题提供建议吗?

我尝试运行的脚本是来自here 的 PublishCloudService.ps1。

【问题讨论】:

    标签: powershell azure


    【解决方案1】:

    我在 2012 年 10 月发布的 cmdlet 中遇到了同样的问题。打开了一张支持票,他们表示这是一个已知问题,并指出我在 8 月发布以解决错误 - https://github.com/WindowsAzure/azure-sdk-tools/downloads。卸载十月版本并安装八月一号后,部署开始按预期工作。

    【讨论】:

    【解决方案2】:

    我是 AzurePowerShell 的新手,但我也有类似的问题,我只是通过以下方式欺骗它:

    1. 将槽设置为暂存
    2. 如果存在则删除当前部署
    3. 创建一个新的部署
    4. 交换它

    这是我的 PowerShell 脚本(修改自:http://weblogs.asp.net/srkirkland/archive/2012/09/11/ci-deployment-of-azure-web-roles-using-teamcity.aspx

    $subscription = "[Your Subscription Name]"
    $service = "[Your Service Name]"
    $slot = "staging" 
    $package = "[Your Package File]"
    $configuration = "[Your Config File]"
    $timeStampFormat = "g"
    $deploymentLabel = "ContinuousDeploy to $service v%build.number%"
    $storageaccount = "[Your Storage Account Name]"
    
    Write-Output "Running Azure Imports"
    Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows   Azure\PowerShell\Azure\*.psd1"
    Import-AzurePublishSettingsFile "[Your publishsettings file]"
    Set-AzureSubscription -SubscriptionName $subscription -SubscriptionId "[Your   Subscription Id]" -CurrentStorageAccount $storageaccount
    Set-AzureSubscription -DefaultSubscription $subscription
    
    function Publish(){
     $deployment = Get-AzureDeployment -ServiceName $service -Slot $slot -ErrorVariable a -  ErrorAction silentlycontinue 
    
     if ($a[0] -ne $null) {
        Write-Output "$(Get-Date -f $timeStampFormat) - No deployment is detected. Creating  a new deployment. "
     }
    
     if ($deployment.Name -ne $null) {
        Write-Output "$(Get-Date -f $timeStampFormat) - Deployment exists in $servicename.   Upgrading deployment."
        Remove-AzureDeployment -Slot $slot -ServiceName $service -Force
     } 
    
     CreateNewDeployment
     Move-AzureDeployment -ServiceName $service
     }
    
    function CreateNewDeployment()
    {
        write-progress -id 3 -activity "Creating New Deployment" -Status "In progress"
        Write-Output "$(Get-Date -f $timeStampFormat) - Creating New Deployment: In   progress"
    
        $opstat = New-AzureDeployment -Slot $slot -Package $package -Configuration    $configuration -Label $deploymentLabel -ServiceName $service
    
        $completeDeployment = Get-AzureDeployment -ServiceName $service -Slot $slot
        $completeDeploymentID = $completeDeployment.deploymentid
    
        write-progress -id 3 -activity "Creating New Deployment" -completed -Status "Complete"
        Write-Output "$(Get-Date -f $timeStampFormat) - Creating New Deployment: Complete,    Deployment ID: $completeDeploymentID"
    }
    
    Write-Output "Create Azure Deployment"
    Publish
    

    它正在工作:)

    【讨论】:

      【解决方案3】:

      我遇到了类似的问题。当我将 cspkg 独立上传到 blob 存储并使用 -Package {url-to-blob} 引用它时,升级就成功了。

      我猜这可能意味着它无法上传 blob 本身,因为某些设置有误,但很难说会是什么。

      你是如何捕获内部异常的?

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      • 2011-07-14
      • 2013-05-23
      相关资源
      最近更新 更多