Azure Cosmos DB仿真器:升级到2.9.2后未经授权 [英] Azure Cosmos DB Emulator: Unauthorized after upgrate to 2.9.2

查看:58
本文介绍了Azure Cosmos DB仿真器:升级到2.9.2后未经授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Azure Cosmos DB仿真器升级到 2.9.2

I upgraded Azure Cosmos DB Emulator to 2.9.2

在2.9.2之前,它像一个超级按钮一样工作,但是现在,省去了我丢失数据但可以预料到的(并且我没有抱怨),在 Explorer 部分,我遇到了两个错误

Before 2.9.2 works like a charm but now, leaving out that I lost the data but that was expected (and I'm not complain), in the Explorer section I got this two errors

查询商品时出错:{代码":401,正文":{代码":未经授权",消息":输入授权令牌无法满足请求.请检查根据协议构建了预期的有效负载,并检查密钥是否正确用过的.服务器使用以下有效负载进行签名:"get \ noffers \ n \ nfri, MYDATE \ n \ n'\ r \ nActivityId: MYID ,Microsoft.Azure.Documents.Common/2.9.2}"标题:{" access-control-allow-credentials:" true," access-control-allow-origin:"," content-location:" https://localhost:8080/offers ,"内容类型:" application/json," date:" MYDATE ," server:" Microsoft-HTTPAPI/2.0," transfer-encoding:" chunked," x-ms-activity-id:"MYID," x-ms-gatewayversion:" version = 2.9.2," x-ms-throttle-retry-count:0," x-ms-throttle-retry-wait-time-ms:0},"activityId":" MYID "}

Error while querying offers: {"code":401,"body":{"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: 'get\noffers\n\nfri, MYDATE \n\n'\r\nActivityId: MYID, Microsoft.Azure.Documents.Common/2.9.2"},"headers":{"access-control-allow-credentials":"true","access-control-allow-origin":"","content-location":"https://localhost:8080/offers","content-type":"application/json","date":"MYDATE","server":"Microsoft-HTTPAPI/2.0","transfer-encoding":"chunked","x-ms-activity-id":"MYID","x-ms-gatewayversion":"version=2.9.2","x-ms-throttle-retry-count":0,"x-ms-throttle-retry-wait-time-ms":0},"activityId":"MYID"}

这:

刷新数据库时出错:{代码":401,正文":{代码":未经授权",消息":输入授权令牌无法满足请求.请检查根据协议构建了预期的有效负载,并检查密钥是否正确用过的.服务器使用以下有效负载进行签名:"get \ noffers \ n \ nfri, MYDATE \ n \ n'\ r \ nActivityId: MYID ,Microsoft.Azure.Documents.Common/2.9.2}"标题:{" access-control-allow-credentials:" true," access-control-allow-origin:"," content-location:" https://localhost:8080/offers ,"内容类型:" application/json," date:" MYDATE ," server:" Microsoft-HTTPAPI/2.0," transfer-encoding:" chunked," x-ms-activity-id:"MYID," x-ms-gatewayversion:" version = 2.9.2," x-ms-throttle-retry-count:0," x-ms-throttle-retry-wait-time-ms:0},"activityId":" MYID "}

Error while refreshing databases: {"code":401,"body":{"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: 'get\noffers\n\nfri, MYDATE \n\n'\r\nActivityId: MYID, Microsoft.Azure.Documents.Common/2.9.2"},"headers":{"access-control-allow-credentials":"true","access-control-allow-origin":"","content-location":"https://localhost:8080/offers","content-type":"application/json","date":"MYDATE","server":"Microsoft-HTTPAPI/2.0","transfer-encoding":"chunked","x-ms-activity-id":"MYID","x-ms-gatewayversion":"version=2.9.2","x-ms-throttle-retry-count":0,"x-ms-throttle-retry-wait-time-ms":0},"activityId":"MYID"}

如果我尝试创建一个新数据库:

If I try to create a new database:

创建数据库asd时出错:{代码":401,正文":{代码":未经授权",消息":输入授权令牌无法满足请求.请检查根据协议构建了预期的有效负载,并检查密钥是否正确用过的.服务器使用以下有效负载进行签名:'post \ ndbs \ n \ n" MYDATE2 " \ n \ n'\ r \ nActivityId: MYID2 ,Microsoft.Azure.Documents.Common/2.9.2},"标题:{" access-control-allow-credentials:" true," access-control-allow-origin:" MYDATE2 GMT",服务器":"Microsoft-HTTPAPI/2.0",传输编码":分块","x-ms-activity-id":" MYID2 ","x-ms-gatewayversion":"version = 2.9.2","x-ms-throttle-retry-count":0,"x-ms-throttle-retry-wait-time-ms":0},"activityId":" MYID2 }

Error while creating database asd: {"code":401,"body":{"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\n"MYDATE2" \n\n'\r\nActivityId:MYID2, Microsoft.Azure.Documents.Common/2.9.2"},"headers":{"access-control-allow-credentials":"true","access-control-allow-origin":"https://localhost:8080","access-control-expose-headers":"Access-Control-Allow-Origin,Access-Control-Allow-Credentials,Content-Type,x-ms-activity-id,x-ms-gatewayversion","content-type":"application/json","date":"MYDATE2 GMT","server":"Microsoft-HTTPAPI/2.0","transfer-encoding":"chunked","x-ms-activity-id":"MYID2","x-ms-gatewayversion":"version=2.9.2","x-ms-throttle-retry-count":0,"x-ms-throttle-retry-wait-time-ms":0},"activityId":"MYID2"}

我尝试了类似线程 Cosmos的答案数据库仿真器:无法获取商品的授权标头,但我什么也没得到

I tried the answers from this similar thread Cosmos DB Emulator: Failed to get authorization headers for offers but I got nothing

MYID,MYID2,MYDATE和MYDATE2只是占位符,我从设置中的原始值更改了它们.

MYID, MYID2, MYDATE and MYDATE2 are just placeholders, which I changed from the original values in my setup.

更新
这是SDK的错误

UPDATE
Here the SDK's error

来源:
System.Private.CoreLib / Microsoft.Azure.DocumentDB.Core

消息:

输入的授权令牌无法处理请求.请检查根据协议构建了预期的有效负载,并检查正在使用的密钥.服务器使用以下有效负载进行签名:'get

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: 'get

星期一,2020年3月2日11:01:04 gmt

mon, 02 mar 2020 11:01:04 gmt

'ActivityId:b6a56fc2-093d-4154-a4d6-d64ca08d167d,Microsoft.Azure.Documents.Common/2.9.2,Windows/6.3.9600documentdb-netcore-sdk/2.6.0

' ActivityId: b6a56fc2-093d-4154-a4d6-d64ca08d167d, Microsoft.Azure.Documents.Common/2.9.2, Windows/6.3.9600 documentdb-netcore-sdk/2.6.0

推荐答案

我使用此参数运行模拟器

I run the emulator with this parameters

/AllowNetworkAccess/KeyFile = GeneratedKey/NoFirewall/Port = 8080

/AllowNetworkAccess /KeyFile=generatedKey /NoFirewall /Port=8080

那么...存储在文件"generatedKey"(使用参数/GenFileKey生成)中的密钥会引起我的所有麻烦!

So...is the key stored inside the file "generatedKey" (generated with parameter /GenFileKey) that causing all my troubles!

我用默认密钥更改了存储在文件中的密钥,然后再次工作!

I changed the key stored in the file with the default key and works again!

这篇关于Azure Cosmos DB仿真器:升级到2.9.2后未经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆