當我將Azure存儲從1.8升級到4.0.1時,以下代碼不再有效。將存儲升級到4.0.1後,Azure存儲容器ListBlobs拋出Uri NULL異常
var myUri = new Uri(generatedURLwithSAS);
var sasContainer = new CloudBlobContainer(myUri);
var result0 = sasContainer.ListBlobs();
Console.WriteLine(result0);
隨着存儲4.0.1,代碼拋出異常:
Exception Type: Microsoft.WindowsAzure.Storage.StorageException
Exception: Value cannot be null.
Parameter name: uriString
Stack Trace:
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.<>c__DisplayClassf.<ListBlobs>b__e(IContinuationToken token)at Microsoft.WindowsAzure.Storage.Core.Util.CommonUtility.<LazyEnumerable>d__0`1.MoveNext()
Exception Type: System.ArgumentNullException
Exception: Value cannot be null.
Parameter name: uriString
Stack Trace:
at System.Uri..ctor(String uriString)
at Microsoft.WindowsAzure.Storage.Blob.Protocol.ListBlobsResponse.<ParseXml>d__0.MoveNext()
at Microsoft.WindowsAzure.Storage.Shared.Protocol.ResponseParsingBase`1.<ParseXmlAndClose>d__6.MoveNext()
at Microsoft.WindowsAzure.Storage.Shared.Protocol.ResponseParsingBase`1.<get_ObjectsToParse>d__0.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.<ListBlobsImpl>b__4a(RESTCommand`1 cmd, HttpWebResponse resp, OperationContext ctx)
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ProcessEndOfRequest[T](ExecutionState`1 executionState)
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
如何得到它的工作任何想法?
我知道我可以使用帳戶和accountkey來創建憑據來訪問容器和列表blob,但我想知道如何做到這一點只與SAS的blob路徑。
任何建議將不勝感激。