没有配置身份验证处理程序来处理该方案:Identity.Application

时间:2016-10-06 10:46:41

标签: asp.net-core asp.net-identity

我成功注册用户并确认身份验证后收到上述错误。当我尝试调用

时发生错误
# do some python stuff to get somes datas 
datas = ...

# assign it into your html
htmlContent = my_html_template.render(datas)

# call the pdf generation
HTML(string=htmlContent).write_pdf(target=response)

我首先将服务分配给IServiceCollection:

await _signInManager.SignInAsync(applicationUser, isPersistent);

在我的Config启动方法中,我在调用app.UseMvc之前调用services.AddIdentity<ApplicationUser, IdentityRole<int>>( config => { config.User.RequireUniqueEmail = true; config.Cookies.ApplicationCookie.LoginPath = "/Account/Login"; config.Cookies.ApplicationCookie.Events = new CookieAuthenticationEvents() { OnRedirectToLogin = async ctx => { if (ctx.Request.Path.StartsWithSegments("/api") && ctx.Response.StatusCode == 200) { ctx.Response.StatusCode = 401; } else { ctx.Response.Redirect(ctx.RedirectUri); } await Task.Yield(); } }; }).AddEntityFrameworkStores<VisualJobsDbContext, int>() .AddDefaultTokenProviders();

如果我将我的电话改为:

app.UseIdentity();

他们myVal将会失败&#39;我没有得到任何错误

1 个答案:

答案 0 :(得分:0)

尝试将app.UseIdentity();添加到Startup.cs Configure方法中,如此回答No authentication handler is configured to authenticate for the scheme: Microsoft.AspNet.Identity.External