2016-12-13 4 views
1

У меня есть этот метод:DocumentDb CreateDocumentQuery перестал работать

/// <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

, которая на самом деле странно, потому что ничего на моем конце не изменилось. Я пробовал делать все, что он сказал, но безрезультатно, у него все еще есть ошибки. Кто-нибудь знает, почему?

+0

Вы пытались изменить хост-процесс на 64 бит? – Saadi

+0

Да, и это работает, но почему это изменилось? На днях это нормально работало – r3plica

+0

Возможно, кто-то изменит его или изменит конфигурацию вашего компьютера. :) – Saadi

ответ

2

Информацию об ошибке можно найти 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(); 
} 
+0

Это не работает для меня. Все еще получаю эту ошибку, используя Azure DocumentDB. – menth0l

Смежные вопросы