Powershell Set-AzureDeployment因StorageException而失败

时间:2013-08-09 09:45:35

标签: visual-studio powershell azure deployment

我使用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中重新创建项目并创建了一个新的存储帐户,但仍面临同样的错误。该脚本适用于我的其他云项目。

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

1 个答案:

答案 0 :(得分:2)

最后,我找到了解决问题的方法。将软件包上传到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