gpt4 book ai didi

c# - DocumentDb CreateDocumentQuery 停止工作

转载 作者:太空宇宙 更新时间:2023-11-03 23:06:05 26 4
gpt4 key购买 nike

我有这个方法:

/// <summary>
/// Gets a list of our documents
/// </summary>
/// <returns></returns>
public List<T> List(string query)
{
// Return our items
return this._client.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(this._databaseName, this._collectionName), query).ToList();
}

直到今天,它一直运行良好。现在它抛出一个错误:

Partition routing information cannot be extracted from the query when running in a 32-bit process. To complete your query and avoid this exception, ensure that your host process is 64-bit.\r\nFor Executable applications, this can be done by unchecking the \"Prefer 32-bit\" option in the project properties window, on the Build tab. \r\nFor VSTest based test projects, this can be done by selecting Test->Test Settings->Default Processor Architecture as X64, from Visual Studio Test menu option.\r\nFor locally deployed ASP.NET Web applications, this can be done by checking the \"Use the 64 bit version of IIS Express for web sites and projects\", under Tools->Options->Projects and Solutions->Web Projects.\r\n

这真的很奇怪,因为我这边什么都没有改变。我尝试了它所说的一切,但无济于事,它仍然有错误。有谁知道为什么吗?

最佳答案

可以找到有关此错误消息的一些信息here .

如果您不使用 DocumentDb 中的分区路由功能,您可以更改代码以提供 FeedOptions 以禁用 EnableCrossPartitionQuery

/// <summary>
/// Gets a list of our documents
/// </summary>
/// <returns></returns>
public List<T> List(string query)
{
// Return our items
return
this
._client
.CreateDocumentQuery<T>(
UriFactory.CreateDocumentCollectionUri(this._databaseName, this._collectionName),
query,
new FeedOptions { EnableCrossPartitionQuery = false };
).ToList();
}

关于c# - DocumentDb CreateDocumentQuery 停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41118542/

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