问题描述
我试图调用添加-的Blob
Azure的cmdlet的
I'm trying to invoke Add-Blob
Azure cmdlet
Add-Blob -BlobType Block -FilePath $packagePath -ContainerName $blobContainerName
和它一直工作得很好,直到最近,但现在它失败
and it has been working just fine until recently but now it fails with
Operation could not be completed within the specified time.
信息。我怀疑,不论什么原因,上传速度已经得到了非常低的,所以它只是不管理上传文件速度不够快。
message. I suspect that for whatever reason the upload speed has got really low and so it just doesn't manage to upload the file fast enough.
是否有可能增加超时值该操作?
Is it possible to increase the timeout value for that operation?
推荐答案
您使用的cmdlet从?请注意,这些cmdlet现在(种)德precated和Windows Azure的管理Cmdlet(的)。不幸的是,加入一滴该cmdlet是不是有新的cmdlet。
Are you using the Cmdlets from http://wappowershell.codeplex.com? Please note that these cmdlets are now (kind of) deprecated and have been replaced by Windows Azure Management Cmdlets (http://msdn.microsoft.com/en-us/library/windowsazure/jj554330.aspx). Unfortunately, the cmdlet to add blob is not there in the new cmdlets.
现在回到你的问题,我不认为这是可以指定与此cmdlet的请求超时并有上codePLEX现场没有源$ C $ C为您修改。你可以做的就是通过PowerShell中直接调用存储客户端库。我从这个博客帖子修改code的自由(http://www.fsmpi.uni-bayreuth.de/~dun3/archives/uploading-a-file-to-azure-blob-storage-from-powershell/528.html)并包括超时参数有支持:
Coming back to your question, I don't think it's possible to specify the request timeout with this Cmdlet and there's no source code available on CodePlex site for you to modify. What you could do is invoke Storage Client library directly through PowerShell. I took the liberty of modifying the code from this blog post (http://www.fsmpi.uni-bayreuth.de/~dun3/archives/uploading-a-file-to-azure-blob-storage-from-powershell/528.html) and included support for Timeout parameter there:
Add-Type -Path "C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\ref\Microsoft.WindowsAzure.StorageClient.dll"
$accountName = "<your account name>";
$accountKey = "<your account key>";
$blobContainerName = "<your blob container name>";
$fullFilePath = "<Full path of the file you wish to upload>";
$requestTimeoutInSeconds = 600;
$cloudStorageAccountNameAndKey = new-object Microsoft.WindowsAzure.StorageCredentialsAccountAndKey($accountName, $accountKey);
$cloudStorageAccount = new-object Microsoft.WindowsAzure.CloudStorageAccount($cloudStorageAccountNameAndKey, $true);
$cloudBlobClient = [Microsoft.WindowsAzure.StorageClient.CloudStorageAccountStorageClientExtensions]::CreateCloudBlobClient($cloudStorageAccount)
$blobContainer = $cloudBlobClient.GetContainerReference($blobContainerName);
$blobContainer.CreateIfNotExist();
$blockBlob = $blobContainer.GetBlockBlobReference("<blob name>");
$blobRequestOptions = new-object Microsoft.WindowsAzure.StorageClient.BlobRequestOptions;
$blobRequestOptions.Timeout = [TimeSpan]::FromSeconds($requestTimeoutInSeconds);
$blockBlob.UploadFile($fullFilePath, $blobRequestOptions);
如果你正在寻找替代微软的PowerShell命令,我可以建议你看一看的[我对这个产品的开发者之一。它有一个完整的存储管理和服务管理的cmdlet。
If you're looking for alternatives to Microsoft's PowerShell Cmdlets, may I suggest you take a look at Cerebrata Azure Management Cmdlets [I'm one of the devs for this product]. It has cmdlets for complete storage management and service management.
希望这有助于。
这篇关于如何更改为附加的Blob Azure的cmdlet的超时值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!