Asp.net mvc MVC中的ASP.NET标识IUserEmailStore错误

Asp.net mvc MVC中的ASP.NET标识IUserEmailStore错误,asp.net-mvc,identity,usermanager,Asp.net Mvc,Identity,Usermanager,当用户与生成的令牌一起注册时,我尝试发送确认电子邮件。代币没问题。但在发送电子邮件时,我遇到以下错误: System.NotSupportedException: Store does not implement IUserEmailStore<TUser>. 请提供帮助。在您的模型中,或者在您的代码中的某个地方,您必须有一个UserStore类(除非您使用像EntityFrameworkIdentity这样的框架) 通过搜索整个解决方案来查找UserStore,您将看到必须在其上

当用户与生成的令牌一起注册时,我尝试发送确认电子邮件。代币没问题。但在发送电子邮件时,我遇到以下错误:

System.NotSupportedException: Store does not implement IUserEmailStore<TUser>.

请提供帮助。

在您的模型中,或者在您的代码中的某个地方,您必须有一个UserStore类(除非您使用像
EntityFrameworkIdentity
这样的框架)

通过搜索整个解决方案来查找
UserStore
,您将看到必须在其上实现此接口

比如:

公共类用户存储:IUserStore、IUserPasswordStore、IUserEmailStore{
}

我刚刚发现我安装了
Microsoft.AspNet.Identity.EntityFramework
v1.0.0
,但我需要
v2.x
。我通过Package Manager控制台输入以下内容安装了它:

Install-Package Microsoft.AspNet.Identity.EntityFramework -Version 2.2.1

在这个更高版本中,
UserStore
实现了具有新电子邮件方法的
IUserEmailStore

Hi@Henrique。是的,我使用的是Microsoft.AspNet.Identity.EntityFramework,因此我知道我不必显式实现IUserStore。让我更担心的是,我在Package Manager中安装了一个示例项目,如下所示:PM>Install Package Microsoft.AspNet.Identity.Samples-Pre。该项目工作良好,能够发送电子邮件,但我的项目不工作。
public class ApplicationUserManager : UserManager<ApplicationUser>
{
        public ApplicationUserManager(IUserStore<ApplicationUser> store)
            : base(store)
        {
        }
}
public class EmailService : IIdentityMessageService
    {
        public Task SendAsync(IdentityMessage message)
        {
            // Plug in your email service here to send an email.
            SmtpClient client = new SmtpClient();
            return client.SendMailAsync(ConfigurationManager.AppSettings["TranscriptEmailAddr"],
                                        message.Destination,
                                        message.Subject,
                                        message.Body);                       
        }
    }
public class UserStore : IUserStore<UserIdentity>, IUserPasswordStore<UserIdentity>, IUserEmailStore<UserIdentity>{
}
Install-Package Microsoft.AspNet.Identity.EntityFramework -Version 2.2.1