try
    {
        // Retrieve storage account from connection-string.
        CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);

        // Create the blob client.
        CloudBlobClient blobClient = storageAccount.createCloudBlobClient();

        // Retrieve reference to a previously created container.
        CloudBlobContainer container = blobClient.getContainerReference("config");

        // Loop through each blob item in the container.
        // If the item is a blob, not a virtual directory.
        for (ListBlobItem blobItem : container.listBlobs()) {
            if (blobItem instanceof CloudBlob) {
                // Download the item and save it to a file with the same name.
                CloudBlob blob = (CloudBlob) blobItem;
                if(blob.getName().equalsIgnoreCase(configFileName)) {
                    blob.download(new java.io.FileOutputStream(HashOutConfig.ROOT_PATH + "/" + configFileName));
                    return HashOutConfig.ROOT_PATH + "/" + configFileName;
                }
            }
        }
        return null;
    }
    catch (Throwable th)
    {
        // Output the stack trace.
        th.printStackTrace();
        Log.e(TAG,"Exception==>>>",th);
        Log.e(TAG,"Error while dowloading file from blob storage"+th.getMessage().toString());
        return null;
    }


10-06 12:16:26.312 4491-5605 / com.microsoft.hashout W / System.err:java.util.NoSuchElementException:枚举结果时发生错误,请检查原始异常以获取详细信息。
10-06 12:16:26.312 4491-5605 / com.microsoft.hashout W / System.err:at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:113)
10-06 12:16:26.313 4491-5605 / com.microsoft.hashout W / System.err:at com.microsoft.hashout.task.DownloadFromBlobStorage.downloadFromAzureBlobStorage(DownloadFromBlobStorage.java:68)
10-06 12:16:26.313 4491-5605 / com.microsoft.hashout W / System.err:at com.microsoft.hashout.task.DownloadFromBlobStorage.doInBackground(DownloadFromBlobStorage.java:38)
10-06 12:16:26.313 4491-5605 / com.microsoft.hashout W / System.err:at com.microsoft.hashout.task.DownloadFromBlobStorage.doInBackground(DownloadFromBlobStorage.java:20)
10-06 12:16:26.317 4491-5605 / com.microsoft.hashout W / System.err:at android.os.AsyncTask $ 2.call(AsyncTask.java:295)
10-06 12:16:26.317 4491-5605 / com.microsoft.hashout W / System.err:at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-06 12:16:26.317 4491-5605 / com.microsoft.hashout W / System.err:at android.os.AsyncTask $ SerialExecutor $ 1.run(AsyncTask.java:234)
10-06 12:16:26.318 4491-5605 / com.microsoft.hashout W / System.err:at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
10-06 12:16:26.318 4491-5605 / com.microsoft.hashout W / System.err:at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:588)
10-06 12:16:26.318 4491-5605 / com.microsoft.hashout W / System.err:位于java.lang.Thread.run(Thread.java:818)
10-06 12:16:26.318 4491-5605 / com.microsoft.hashout W / System.err:由以下原因引起:com.microsoft.azure.storage.StorageException:服务器无法验证请求。确保包括签名在内的Authorization标头的值正确形成。
10-06 12:16:26.319 4491-5605 / com.microsoft.hashout W / System.err:at com.microsoft.azure.storage.core.StorageRequest.materializeException(StorageRequest.java:305)
10-06 12:16:26.319 4491-5605 / com.microsoft.hashout W / System.err:at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:175)
10-06 12:16:26.319 4491-5605 / com.microsoft.hashout W / System.err:at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:109)
10-06 12:16:26.320 4491-5605 / com.microsoft.hashout W / System.err:...还有9个

最佳答案

Caused by: com.microsoft.azure.storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

凭证错误吗?

07-28 01:53
查看更多