Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么ASP.Net标识不';在MVC应用程序中,是否将结果(数据)反映回数据库?_C#_Asp.net Mvc_Asp.net Identity_Identity - Fatal编程技术网

C# 为什么ASP.Net标识不';在MVC应用程序中,是否将结果(数据)反映回数据库?

C# 为什么ASP.Net标识不';在MVC应用程序中,是否将结果(数据)反映回数据库?,c#,asp.net-mvc,asp.net-identity,identity,C#,Asp.net Mvc,Asp.net Identity,Identity,我在asp.net mvc identity的ApplicationUser类中添加了两个属性,如下所示: public class ApplicationUser : IdentityUser { public string Name { get; set; } public string Phone { get; set; } public async Task<ClaimsIdentity> GenerateUserIde

我在asp.net mvc identity的
ApplicationUser
类中添加了两个属性,如下所示:

public class ApplicationUser : IdentityUser
    {
        public string Name { get; set; }
        public string Phone { get; set; }
        public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
            // Add custom user claims here
            return userIdentity;
        }
    }
公共类应用程序用户:IdentityUser
{
公共字符串名称{get;set;}
公用字符串电话{get;set;}
公共异步任务GenerateUserIdentityAsync(UserManager),但找不到解决我的问题的方法。如有任何帮助,将不胜感激


别忘了:连接字符串没有问题,一切都很好。

我在文档中没有看到这会将任何内容保存到数据库中。此外,您还可以根据配置和插件(如facebook auth或google等)以多种方式设置ASP.Identity。您没有指定它的配置方式,也没有提供您的配置。@Igor我没有它的任何配置,顺便说一句,它本身不应该工作吗?需要先配置吗?实际上它有时工作,但它停止工作。当您使用def时,SP.net identity有一个完整的配置类visual studio中包含的ault模板。必须对其进行配置,因为您必须指定多个行为点,如持久化用户会话、数据库连接等@Igor抱歉太懒了。asp.net mvc应用程序模板中包含的配置类的名称是什么?能否在d
Phone
字段?是否为数据库架构更改创建了EF迁移?