我尝试使用this microsoft azure node.js SDK来处理blob存储并简单地上传文件。
当我在Windows 7计算机上运行相同的代码时,该服务能够正确验证并上传图像。 Windows 8机器和Windows 7机器都在运行节点v.0.12.2,但是Windows 8机器生成的请求日期标题周围的错误太旧了。好像它使用我的系统时间作为GMT而天蓝色的服务在我的时区或其他地方进行身份验证?
代码:
var azure = require('azure-storage');
var blobService = azure.createBlobService(myStorageAccount, myAccessKey);
blobService.createContainerIfNotExists('testzies', {publicAccessLevel : 'blob'}, function(error, result, response){
});
blobService.createBlockBlobFromLocalFile('testzies', 'first', 'C:/temp/sample.jpg', function(error, result, response){
});
错误,仅在Windows 8机器上:
{[错误:禁止]} {[错误:服务器无法验证 请求。确保形成Authorization标头的值 正确包括签名。代码:' AuthenticationFailed',
authenticationerrordetail:'请求日期标题太旧:\'星期五,5月22日 2015 02:56:35 GMT \'',statusCode:403}
答案 0 :(得分:0)
我找到了自己的问题的答案here。