从网络工作时,Cosmo DB Emulator出现未经授权的错误

时间:2018-07-30 14:00:01

标签: node.js azure azure-cosmosdb

我在Win10虚拟机上有Cosmos DB Emulator。我想通过网络在主机Linux机器的节点应用程序中使用它。

生成密钥文件以启用网络访问后,使用以下命令启动仿真器,

CosmoDB.Emulator.exe /AllowNetworkAccess /Keyfile=keyfile /NoFirewall

然后使用环境变量启动节点应用

NODE_TLS_REJECT_UNAUTHORIZED=0

当尝试使用默认主密钥连接到数据库时,出现以下未授权错误

"{\"code\":\"Unauthorized\",\"message\":\"The input authorization 
token can't serve the request. Please check that the expected payload 
is built as per the protocol, and check the key being used. Server 
used the following payload to sign: 'post\\ndbs\\n\\nmon, ..."}"

在Cosmo DB仿真器documentation中,它显示“如果您使用/ Key选项启动了仿真器,请使用生成的密钥代替...” 。如果将生成的密钥文件中的生成的密钥用作主密钥,则不会返回任何响应。

此设置可能有什么问题?

0 个答案:

没有答案