如何在asp.net vnext中注册身份validation类型名称

因此,我正在更新MongoDB的开源asp.net身份提供程序,以便与Asp.Net Identity 3.0(又名vnext)一起使用。 到目前为止,我已经能够注册提供程序并创建用户,但是当使用SignInManager时,如果提供了正确的UserName / Pass,我会收到错误

InvalidOperationException:未接受以下身份validation类型:Microsoft.AspNet.Identity.Application

我已经将错误跟踪到这里https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNet.PipelineCore/DefaultHttpResponse.cs

但我似乎无法看到SignInContext.Accepted名称被添加到SignInContext的位置。

我正在使用VS14 CTP2中使用的所有vnext库的Alpha-2版本

下面是我的Startup.cs

public void Configure(IBuilder app) { try { // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 var configuration = new Configuration(); configuration.AddJsonFile("config.json"); configuration.AddEnvironmentVariables(); // app.UseLogRequests("try"); app.UseErrorPage(ErrorPageOptions.ShowAll); app.UseServices(services => { services.AddIdentity() .AddMongoDB(configuration.Get("Data:MongoIdentity:ConnectionString"), configuration.Get("Data:MongoIdentity:DBName")) .AddHttpSignIn(); // Add MVC services to the services container services.AddMvc(); }); // Add static files to the request pipeline app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "api", template: "api/{controller}/{action}", defaults: new { action = "Index" }); }); // Add cookie-based authentication to the request pipeline app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), }); } catch (Exception ex) { Console.Write(ex.ToString()); throw; } } 

事实certificate我在CookieAuthentication之前设置了MVC,因此在尝试validation用户时,AuthenticationType未在MVC中注册。 由于MVC依赖于身份validation,我只需要将其提升并在MVC之前注册它。