当我使用下面的代码将文件上传到服务器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