将 documentDB sdk .net 更新到 1.10.0 或最新版本后出现错误

getting error after updatet documentDB sdk .net to 1.10.0 or latest

我有一个项目,它工作正常,但由于 Microsoft DocumentDB 的旧版本,我不能使用所有查询,如 between 等等。所以,我更新了包。

以下是我当前的软件包版本。

Microsoft.Azure.DocumentDB : Version - 1.12.2
DocumentDB.AspNet.Identity : Version - 1.0.10-beta

包的旧版本。

Microsoft.Azure.Documents.Client 0.9.0-preview
Microsoft.AspNet.Identity.Core 2.1.0

异常:

Method not found: 'System.Threading.Tasks.Task1<Microsoft.Azure.Documents.Client.FeedResponse1> Microsoft.Azure.Documents.Linq.IDocumentQuery`1.ExecuteNextAsync()'.

堆栈跟踪:

at DocumentDB.AspNet.Identity.UserStore1.<GetUsers>d__9.MoveNext()<br> at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine) at DocumentDB.AspNet.Identity.UserStore1.GetUsers(Expression1 predicate) at DocumentDB.AspNet.Identity.UserStore1.<FindByNameAsync>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNet.Identity.TaskExtensions.CultureAwaiter1.GetResult() at Microsoft.AspNet.Identity.UserManager2.<FindAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Cherish.Api.Controllers.LoginController.d__9.MoveNext() in E:\Chandresh\MVC Projects\Cherish\Experiment\Cherish.Api\Controllers\LoginController.cs:line 90

代码片段:

 var Client = new DocumentClient(new
 Uri(ConfigurationManager.AppSettings["DocumentDbEndpointUrl"]),
 ConfigurationManager.AppSettings["DocumentDbAuthKey"]);
 var manager = new ApplicationUserManager(new
 UserStore<ApplicationUser>(Client, ConfigurationManager.AppSettings["DocumentDbDatabaseName"], "UserDetail"));

错误行:

await UserManager.FindAsync(model.Email, model.Password);

看来是SDK兼容性问题。似乎有一个 issue that DocumentDB.AspNet.Identity 1.0.10-beta SDK works with Microsoft.Azure.DocumentDB : Version >= 1.10

请尝试使用以下两种方法解决此问题。

1.If 降级 Microsoft.Azure.DocumentDB是可以的,请在您的其他项目中使用Microsoft.Azure.DocumentDB1.9.5版本的SDK。

2.Please 尝试下载 DocumentDB.AspNet.Identity 源代码。并将源码工程中的Microsoft.Azure.DocumentDB版本更新为最新的(1.14.1)。然后重新编译以生成一个新的 dll 以在您的其他项目中引用,然后它应该可以正常工作。我已经在我这边测试过了。