當我使用下面的代碼將文件上傳到服務器Azure blob時,我遇到了與Azure Blob存儲相關的錯誤。com.microsoft.windowsazure.services.core.storage.StorageException:服務器無法驗證請求
CloudStorageAccount account;
CloudBlobClient serviceClient;
CloudBlobContainer container;
CloudBlockBlob blob;
final String bucketName = PropertyReader.getValue("aws.properties", bucket);
account = CloudStorageAccount.parse(storageConnectionString);
serviceClient = account.createCloudBlobClient();
// Container name must be lower case.
container = serviceClient.getContainerReference(bucketName);
container.createIfNotExist();
// Set anonymous access on the container.
BlobContainerPermissions containerPermissions;
containerPermissions = new BlobContainerPermissions();
containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
container.uploadPermissions(containerPermissions);
// Upload an image file.
blob = container.getBlockBlobReference(imageName);
blob.upload(imageStream, imageArray.length);
我使用的代碼,並建立MYCOMPUTER(Windows 8中)的本地主機上,能正常工作。但是,當我部署到服務器Linux它捕捉異常
com.microsoft.windowsazure.services.core.storage.StorageException:服務器無法驗證請求。確保授權標頭的值正確形成,包括簽名。
我發現這個問題上相關主題 - Azure API The server failed to authenticate the request 但它仍然沒有幫助解決我的問題。我該如何解決?
如果不是可運行的HTML/CSS/JS代碼,請不要使用Stack Snippets來添加代碼。我已將片段更改爲普通代碼塊,更正了格式並改進了一些語法。 – Harry
任何人都可能幫助我:( – Harry