Azure插入在数据库中失败但查询有效

时间:2012-11-12 21:01:56

标签: azure azure-compute-emulator azure-storage-emulator

我正在尝试插入/替换:

          insertOrReplaceEntity('myusertables', task, function(error)

它总是转到错误代码,表明没有发生插入。

如何在Azure中调试它?

我使用的是Azure模拟器,并且代码中包含:

var account = azure.ServiceClient.DEVSTORE_STORAGE_ACCOUNT;
var accountKey = azure.ServiceClient.DEVSTORE_STORAGE_ACCESS_KEY;

我的PUT因403而失败。

{ error:
   { [Error: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctl
including the signature.]
     code: 'AuthenticationFailed',
     message: 'Server failed to authenticate the request. Make sure the value of Authorization header is formed correc
y including the signature.' },
  response:
   { isSuccessful: false,
     statusCode: 403,
     body:
      { '@': [Object],
        code: 'AuthenticationFailed',
        message: [Object] },
     headers:
      { 'content-length': '356',
        'content-type': 'application/xml',
        server: 'Microsoft-HTTPAPI/2.0',
        date: 'Mon, 12 Nov 2012 20:57:10 GMT' },
     md5: undefined } }

1 个答案:

答案 0 :(得分:1)

如描述here,存储模拟器不支持插入或替换实体或插入或合并实体,称为upsert功能。这就是为什么当你在代码中使用insertOrReplaceEntity时它会返回一个错误。如果必须验证代码,则可能需要使用真正的Azure表存储进行检查。