输入字符串的格式不正确

输入字符串的格式不正确

本文介绍了输入字符串的格式不正确-使用了错误的上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将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:

在尝试查询数据库时.关于这可能是什么的任何线索?

when trying to query the database. Any clues as to why that might be?

推荐答案

根据评论:

Microsoft.AspNetCore.Identity.UserStoreBase.ConvertIdFromString(字符串ID).

Microsoft.AspNetCore.Identity.UserStoreBase.ConvertIdFromString(string id).

原来我有一个使用旧guid格式的cookie,简单的解决方法是 清除Cookie.

Turns out I had a cookie using the old guid format, simple fix was to clear cookies.

问题在于,您以前的某些登录可能是在ID为GUID时完成的.您将其更改为int,因此现在它不再知道如何处理GUID.最简单的解决方案是删除cookie,有效地注销您并强迫您再次登录(改用int).

The issue is that some of your previous logins were likely done when the ID was a GUID. You changed it to int, and so now it doesn't know how to handle the GUID any more. The simplest solution will be to delete your cookies, effectively logging you out and forcing you to login again (using int instead).

这篇关于输入字符串的格式不正确-使用了错误的上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 04:25