首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FormatException和ArgumentException误差

FormatException和ArgumentException误差
EN

Stack Overflow用户
提问于 2018-11-05 04:58:42
回答 1查看 312关注 0票数 0

在尝试将标识从string更改为long时,我在Visual Studio应用程序中获得了这些错误。还有其他人遇到过这些错误吗?

处理请求时发生了未处理的异常。FormatException:输入字符串格式不正确。System.Number.StringToNumber(ReadOnlySpan str,NumberStyles options,ref NumberBuffer number,NumberFormatInfo info,bool parseDecimal) ArgumentException: 81d1aa6c-b70a-4d64-a62a-e177d79b944e不是Int64的有效值。参数名称:值System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext上下文、CultureInfo区域性、对象值)

EN

回答 1

Stack Overflow用户

发布于 2018-11-07 07:54:36

要将标识主键从string更改为long,请执行以下步骤:

  • 添加ApplicationUser.cs 公共类ApplicationUser:IdentityUser {}
  • 修改ApplicationDbContext 公共类ApplicationDbContext : IdentityDbContext { public ApplicationDbContext(DbContextOptions options):base(options) {}
  • 修改Startup.cs services.AddDefaultIdentity() .AddEntityFrameworkStores();
  • _LoginPartial.cshtmlIdentityUser修改为ApplicationUser @ Microsoft.AspNetCore.Identity @inject SignInManager @inject UserManager @if (SignInManager.IsSignedIn(用户)){
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53148570

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档