【问题标题】:Powershell Set-AzureDeployment fails with a StorageExceptionPowershell Set-AzureDeployment 失败并出现 StorageException
【发布时间】:2013-08-09 09:45:34
【问题描述】:

我使用来自http://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/ 的 powershell 脚本“PublishCloudService.ps1”来部署我的云项目。 不知何故,一个项目没有部署,我收到以下错误消息:

Set-AzureDeployment : Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
At D:\Users\4711\Untitled1.ps1:78 char:22
+     $setdeployment = Set-AzureDeployment -Upgrade -Slot $slot -Package $packageL ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzureDeployment], StorageException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.SetAzureDeploymentCommand

受影响的命令是:

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

使用 Visual Studio 中的发布对话框部署项目手册没有任何问题。

我已经尝试在 Visual Studio 中重新创建项目并创建了一个新的存储帐户,但仍然遇到同样的错误。该脚本适用于我的其他云项目。

如何获得有关错误的更多信息?有什么建议吗?

【问题讨论】:

  • 您使用的 SDK 是否正确?
  • 我更新到 sdk 2.1 但仍然遇到同样的错误

标签: visual-studio powershell azure deployment


【解决方案1】:

最后,我找到了解决问题的方法。将包上传到 blob 存储并使用 Set-AzureDeployment 命令中的 url 可以正常工作:

# If the target container does not already exist, create it. 
$containerState = Get-AzureStorageContainer -Name $containerName -ea 0
if ($containerState -eq $null)
{
    New-AzureStorageContainer -Name $containerName | out-null
}

Set-AzureStorageBlobContent -File $packageLocation -Container $containerName -Blob $blob -Force| Out-Null

$script:packageLocation = (Get-AzureStorageBlob -blob $blobName -Container $containerName).ICloudBlob.uri.AbsoluteUri

【讨论】:

  • 你救了我的命!非常感谢。这个好像坏了!
  • 是的,Azure 上传好像坏了。但是解决方法仍然可以正常工作。很高兴为您提供帮助。
  • 您是否将上述代码添加到现有的“PublishCloudService.ps1”脚本中?
  • @Khash 是的,我添加了上面的代码来解决这个问题。但也许您可以尝试新的 Azure SDK 2.2(昨天发布)。我希望他们解决了这个问题......
  • @jisaak,我对 PS 脚本不是很熟悉,但不知道如何将代码 sn-p 添加到现有脚本 (PublishCloudService.ps1),例如我不能在脚本中找到“$containerName”以在“Get-AzureStorageContainer”中使用它,能否附上整个脚本?谢谢
猜你喜欢
  • 2022-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-24
  • 1970-01-01
相关资源
最近更新 更多