找不到类型或命名空间名称"ApplicationUserManager"

col*_*mbo 3 model-view-controller google-login

我已经跟随Rick Anderson的以下文章: Facebook,Twitter,LinkedIn和Google OAuth2登录MVC 5应用程序

我正在尝试测试Google身份验证并在我的本地计算机上运行...

Startup.Auth.cs如下(这次完全符合每篇文章):

// Configure the db context and user manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);


// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
// Configure the sign in cookie
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
    LoginPath = new PathString("/Account/Login"),
    Provider = new CookieAuthenticationProvider
    {
        OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
            validateInterval: TimeSpan.FromMinutes(30),
            regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
    }
});

app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
Run Code Online (Sandbox Code Playgroud)

有错误是找不到类型或命名空间名称'ApplicationUserManager'.

我们必须去创建ApplicationUserManager吗?(如下所述:http://blogs.msdn.com/b/webdev/archive/2014/02/18/10499038.aspx

或更好:

我们在哪里ApplicationUserManager?是否有应该创建它的nuget包?

我在不同的地方读过ApplicationUserManager曾经在IdentityConfig.cs中,但如果你坚持使用当前的nuget包,IdentityConfig.cs就不再存在了.

jan*_*y02 5

我遇到过同样的问题.我一直在关注一个教程,但是我从VS 2012开始了一个空项目的MVC 5项目.我认为本教程的创建者使用了一个不同的模板,该模板已经包含了我在NuGet中找到的内容.

它是以下内容:

在此输入图像描述