2012-11-12 109 views
2

我试图做一个插入/替换:Azure的插入失败的数据库,但查询工作

  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

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