【发布时间】:2014-08-09 17:12:28
【问题描述】:
我在 Azure 启动任务中使用 powershell 从 blobstorage 下载 blob。我今天通过 NuGet 将 Microsoft.WindowsAzure.Storage 库从 3.0.3.0 更新到了 4.0.1.0。
在仍然正确下载库更新文件后,我在命令窗口中收到相同类型的警告:
'无法加载一种或多种请求的类型。检索 LoaderExceptions 属性以获取更多信息。'
function download_from_storage ($container, $blob, $connection, $destination) {
Add-Type -Path ((Get-Location).Path + '\Microsoft.WindowsAzure.Storage.dll')
$storageAccount = [Microsoft.WindowsAzure.Storage.CloudStorageAccount]::Parse($connection)
$blobClient = New-Object Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient($storageAccount.BlobEndpoint, $storageAccount.Credentials)
$container = $blobClient.GetContainerReference($container)
$remoteBlob = $container.GetBlockBlobReference($blob)
$remoteBlob.DownloadToFile($destination + "\" + $blob, [System.IO.FileMode]::OpenOrCreate)
}
$connection_string = 'DefaultEndpointsProtocol=https;AccountName=<AcountName>;AccountKey=<Accountkey>'
# JRE
$jre = 'jre-7u60-windows-x64.exe'
$node = 'node-v0.10.29-x64.msi'
download_from_storage 'java-runtime' $jre $connection_string (Get-Location).Path
download_from_storage 'nodejs' $node $connection_string (Get-Location).Path
由于它仍在工作,我只是不知道为什么该消息首先出现。
【问题讨论】:
标签: powershell azure azure-storage