Hangfire with Cosmos DB:响应状态代码不表示成功:NotFound (404);子状态:0;活动编号

Hangfire with Cosmos DB: Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId

我有使用 Cosmos DB 作为数据库的 Hangfire。当我选择“重试”选项卡时出现错误:

An unhandled exception occurred while processing the request.
AggregateException: One or more errors occurred. (Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId: 68d632fc-8c5a-4624-80a5-7e9bc0d252f0; Reason: ({
"Errors": [
"Resource Not Found. Learn more: https://aka.ms/cosmosdb-tsg-not-found"
]
});)
System.Threading.Tasks.Task.Wait(int millisecondsTimeout, CancellationToken cancellationToken)

CosmosException: Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId: 68d632fc-8c5a-4624-80a5-7e9bc0d252f0; Reason: ({
"Errors": [
"Resource Not Found. Learn more: https://aka.ms/cosmosdb-tsg-not-found"
]
});
Microsoft.Azure.Cosmos.ResponseMessage.EnsureSuccessStatusCode()

当我尝试在 Cosmos DB 上创建 select 语句以获取具有 key='retries' 的项目时:

SELECT * FROM c where c.key = 'retries' and c.value = 'b7ad3971-8647-4a29-a2a7-412e2da41527'

我在 Cosmos DB 中遇到错误:

Failed to query item for container hangfire:
 Gateway Failed to Retrieve Query Plan: Message: {"errors":[{"severity":"Error","location":{"start":46,"end":51},"code":"SC1001","message":"Syntax error, incorrect syntax near 'value'."}]}

ActivityId: 4bc1d85a-4ea6-47c2-95d0-81bdde78f389, Microsoft.Azure.Documents.Common/2.11.0, Microsoft.Azure.Documents.Common/2.11.0

当我这样 select 时:

SELECT * FROM c where c.key = 'retries'

我可以看到没有错误的结果。当我将 AND c.value=... 添加到 where 子句时发生错误。 我无法在 Hangfire dashboard 上打开重试选项卡。 Json 在 Cosmos 中看起来像:

{
        "key": "retries",
        "value": "b7ad3971-8647-4a29-a2a7-412e2da41527",
        "score": 0,
        "created_on": 1611580578,
        "type": 7,
        "id": "b04c5c23-d324-45e1-acce-cdd2379c4073",
        "_rid": "QO5WANzKkljY-gEAAAAAAA==",
        "_self": "dbs/QO5WAA==/colls/QO5WANzKklg=/docs/QO5WANzKkljY-gEAAAAAAA==/",
        "_etag": "\"2d01ed73-0000-0100-0000-600ec4a30000\"",
        "_attachments": "attachments/",
        "_ts": 1611580579
    },

您收到此错误的原因是 value 是关键字。请尝试以下查询,它应该有效:

SELECT * FROM c where c.key = 'retries' and c["value"] = 'b7ad3971-8647-4a29-a2a7-412e2da41527'