最近我们将旧的Membership更换为MVC中的ASP.NET Identity。 根据{{3}}进行 试图在“
”中获取“ApplicationUserManager”实例public void ConfigureAuth(IAppBuilder app)
{
// Configure the db context, user manager and signin manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<IdentityUserManager>( ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
UserManager = HttpContext.Current.GetOwinContext().GetUserManager< ApplicationUserManager >();
}
从Startup.cs调用哪个 但是,我收到一个例外:
"No owin.Environment item was found in the context".
我在配置文件中添加了所有参数,如其他帖子中所述
<add key="owin:AutomaticAppStartup" value="true" />
<add key="owin:AppStartup" value="[namespace]Startup, [namespace]" />
以上启动命名空间:
[assembly: OwinStartup(typeof([namespace].Startup))]
还有其他建议吗?