您好强大的 Windows Azure 开发人员,
我在 Eclipse 中使用 PHP SDK for Windows Azure 处理本地计算和存储模拟器上的存储表
我正在运行这段代码(基本上我正在更新数据):
$statistics = AzureStorageTable::connection()->retrieveEntities(self::$statisticsTableName);
foreach($statistics as $statistic) {
$block = $statistic->getRowKey();
if(isset($processedLogs[$block])) {
$processedLog = $processedLogs[$block];
$statistic->time = ($statistic->time + $processedLog[0]);
$statistic->count = ($statistic->count + $processedLog[1]);
$statistic->average = ($statistic->time / $statistic->count);
AzureStorageTable::connection()->updateEntity(self::$statisticsTableName,$statistic);
}
}
我得到:
Microsoft_WindowsAzure_Exception
服务器未能验证请求。确保 Authorization 标头的值正确形成,包括签名。
它在 SDK 中失败:
存储/Table.php (615) Microsoft_WindowsAzure_Storage_Table-> _changeEntity
实体对象如下所示:
Microsoft_WindowsAzure_Storage_DynamicTableEntity(5) ▼ {
"_dynamicProperties" protected => array(4) ▼ {
"timestamp" => stdClass(3) ▼ {
"Name" => "Timestamp" (9)
"Type" => "Edm.DateTime" (12)
"Value" => DateTime(3) { ... }
}
"time" => stdClass(3) ▼ {
"Name" => "time" (4)
"Type" => "Edm.Double" (10)
"Value" => 95.899748802185
}
"count" => stdClass(3) ▼ {
"Name" => "count" (5)
"Type" => "Edm.Int32" (9)
"Value" => 44
}
"average" => stdClass(3) ▼ {
"Name" => "average" (7)
"Type" => "Edm.Double" (10)
"Value" => 2.1795397455042
}
}
"_partitionKey" protected => "timers" (6)
"_rowKey" protected => "%2F" (3)
"_timestamp" protected => DateTime(3) ▼ {
"date" => "2012-04-20 22:51:50" (19)
"timezone_type" => 3
"timezone" => "UTC" (3)
}
"_etag" protected => "W/"datetime'2012-04-20T22%3A51%3A50.483Z'"" (42)
}
尝试删除实体时,我也遇到了同样的错误。
我试图创建表实体,而不是从存储中获取它,然后使用相同的对象进行更新,但它不起作用。
我知道根据谷歌搜索可能存在时间问题,但我在系统上的时间是正确的(我是 UTC+1)。不知何故,存储中的时间戳比实际时间晚了 2 小时,但我不知道该怎么办。
我确实有 Fiddler2,但我不知道如何设置它来捕获与http://127.0.0.1:10002(本地表存储)的通信。
知道我做错了什么吗?