将文档数据库 SDK .net 更新到 1.10.0 或更高版本后出错



我有一个项目,它运行良好,但由于旧版本的Microsoft DocumentDB我无法使用所有查询,例如 between and 等。所以,我已经更新了软件包。

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

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

例外:

未找到方法: '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()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1.Start[TStateMachine](TStateMachine& 状态机) 在 DocumentDB.AspNet.Identity.UserStore1.GetUsers(Expression1 谓词)在 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() 在 Cherish.Api.Controllers.LoginController.d__9.移动下一个() 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 兼容性问题。似乎存在一个问题,即DocumentDB.AspNet.Identity 1.0.10-beta SDK与Microsoft.Azure.DocumentDB一起使用:版本>= 1.10

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

1.如果可以降级Microsoft.Azure.DocumentDB,请在其他项目中使用Microsoft.Azure.DocumentDB 1.9.5版本的SDK。

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

最新更新