输入字符串的格式不正确-使用了错误的上下文 [英] Input string was not in a correct format - wrong context is used
问题描述
在将ASP.NET Core身份更改为使用int
而不是GUID之后(按照
After changing ASP.NET Core Identity to use int
rather than GUID (as per this blog post) I am receiving the following error:
ArgumentException:395438ed-1cd9-4420-8a58-3f3b1f550bfc无效 Int32的值.参数名称:值 System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext 上下文,CultureInfo文化,对象值) Microsoft.AspNetCore.Identity.UserStoreBase.ConvertIdFromString(字符串ID) Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore.FindByIdAsync(string userId,CancellationToken cancelToken) Microsoft.AspNetCore.Identity.UserManager.FindByIdAsync(string 用户身份) Microsoft.AspNetCore.Identity.UserManager.GetUserAsync(ClaimsPrincipal 主要的) Microsoft.AspNetCore.Identity.SignInManager.ValidateSecurityStampAsync(ClaimsPrincipal 主要的) Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidateAsync(CookieValidatePrincipalContext 语境) Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleAuthenticateAsync() Microsoft.AspNetCore.Authentication.AuthenticationHandler.AuthenticateAsync() Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext 上下文,字符串方案) Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext 语境) Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext 语境) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext 上下文)
ArgumentException: 395438ed-1cd9-4420-8a58-3f3b1f550bfc is not a valid value for Int32. Parameter name: value System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) Microsoft.AspNetCore.Identity.UserStoreBase.ConvertIdFromString(string id) Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore.FindByIdAsync(string userId, CancellationToken cancellationToken) Microsoft.AspNetCore.Identity.UserManager.FindByIdAsync(string userId) Microsoft.AspNetCore.Identity.UserManager.GetUserAsync(ClaimsPrincipal principal) Microsoft.AspNetCore.Identity.SignInManager.ValidateSecurityStampAsync(ClaimsPrincipal principal) Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidateAsync(CookieValidatePrincipalContext context) Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleAuthenticateAsync() Microsoft.AspNetCore.Authentication.AuthenticationHandler.AuthenticateAsync() Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, string scheme) Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
在尝试查询数据库时.关于这可能是什么的任何线索?
when trying to query the database. Any clues as to why that might be?