找不到类型或名称空间名称"ApplicationUserManager" [英] The type or namespace name 'ApplicationUserManager' could not be found
问题描述
Rick Anderson尽我所能阅读了以下文章:具有Facebook,Twitter,LinkedIn和Google OAuth2登录功能的MVC 5应用
I have followed to the following article as best I can by Rick Anderson: MVC 5 App with Facebook, Twitter, LinkedIn and Google OAuth2 Sign-on
我正在尝试对Google身份验证进行测试并在我的本地计算机上工作...
I am trying to get Google Authentication tested and working on my local machine...
Startup.Auth.cs如下(这次完全与文章相同):
Startup.Auth.cs is as follows (exactly as per article this time):
// 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);
错误是找不到类型或名称空间名称'ApplicationUserManager'.
There error is The type or namespace name 'ApplicationUserManager' could not be found.
我们必须去创建ApplicationUserManager吗?(如此处所述: http://blogs.msdn.com/b/webdev/archive/2014/02/18/10499038.aspx
Do we have to go creating the ApplicationUserManager? (like described here: http://blogs.msdn.com/b/webdev/archive/2014/02/18/10499038.aspx
或更佳:
我们在哪里使用ApplicationUserManager?有一个应该创建它的nuget包吗?
Where us ApplicationUserManager? Is there a nuget package that should have created it?
我在不同的地方阅读了ApplicationUserManager曾经在IdentityConfig.cs中使用的内容,但是如果您坚持使用当前的nuget软件包,则IdentityConfig.cs将不再存在.
I read in different places that ApplicationUserManager used to be in IdentityConfig.cs, but IdentityConfig.cs is no longer there if you stick to current nuget packages.
推荐答案
我遇到了同样的问题.我一直在关注教程,但是我从VS 2012开始使用一个空项目启动了MVC 5项目.我认为本教程的创建者使用的模板已经包含了我在NuGet中找到的模板.
I had the same issue. I have been following a tutorial but I started the MVC 5 project from VS 2012 with an empty project. I think that the creator of the tutorial used a different template that already contained what I found in NuGet.
以下内容:
这篇关于找不到类型或名称空间名称"ApplicationUserManager"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!