gpt4 book ai didi

azure - DocumentDb 客户端接收无效的 api 版本 documentdb 确保传递有效的 x-ms-version header 值

转载 作者:行者123 更新时间:2023-12-05 03:09:32 24 4
gpt4 key购买 nike

我正在通过模拟器进行一些本地 DocumentDb 开发。我的 DocumentDb 模拟器已经使用了一两个月了。当我下载 DocumentDb 客户端的最新 Nuget 组件时,我无法连接到它并收到错误:无效的 api 版本 documentdb 确保传递有效的 x-ms-version header 值

所以...我知道我需要做什么(我想)。它调整 x-ms-version header ,使其与我旧的 DocumentDb Emulator 安装相匹配。问题是,如何更改请求的版本号,以及应该将版本号更改为什么?

我认为不断升级我的 DocumentDb 本地模拟器不是一个可接受的解决方案。特别是当我的数据等没有备份/恢复时。

处理这个问题的最佳方法是什么?

谢谢!

詹姆斯

最佳答案

如这个document提到 DocumentDB REST API 的 x-ms-version:

The version of DocumentDB REST service. The latest version is used when the header is not provided.

对于 Azure DocumentDB 服务支持的 REST API 版本,您可以引用此 link .

我经过测试发现,使用Microsoft.Azure.DocumentDB.Core 1.1.0时,x-ms-version将配置为2017 -01-19,而对于 Microsoft.Azure.DocumentDB.Core 1.0.0x-ms-version 将为 2016-07- 11 .

Microsoft.Azure.DocumentDB.Core 1.1.0于2017年2月16日发布。您可以下载最新的DocumentDB Emulator version 1.11.136.2 .

The question is, how do I change the version number on the request, AND what should I change the version number to?

DocumentDb 客户端库为您提供了一种访问 documentdb 的简单方法,据我所知,该库没有为您提供配置 x-ms-version 的方法。

I don't think its an acceptable solution to constantly be upgrading my DocumentDb local emulator. Especially when there is no backup/restore of my data etc.

Azure DocumentDB 模拟器仅提供模拟 Azure DocumentDB 服务以用于开发目的的本地环境。

Data created in one version of the DocumentDB Emulator is not guaranteed to be accessible when using a different version. If you need to persist your data for the long term, it is recommended that you store that data in an Azure DocumentDB account, rather than in the DocumentDB Emulator.

如果您不想不断升级 DocumentDb 模拟器来保存数据,则需要利用指定​​版本的 DocumentDB 客户端库来访问 DocumentDb 模拟器。

关于azure - DocumentDb 客户端接收无效的 api 版本 documentdb 确保传递有效的 x-ms-version header 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42516702/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com