You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ServiceStack 8集成OpenIdConnect后登出报错:缺失SignInManager?

问题解决方法

1. 必须注册SignInManager及相关依赖

ServiceStack不会自动注册ASP.NET Identity的SignInManager<TUser>,需要手动在DI容器中添加注册代码(假设你的用户类为ApplicationUser):

builder.Services.AddScoped<SignInManager<ApplicationUser>>();

2. 确认Identity核心服务的完整注册

要保证ASP.NET Identity基础服务注册完整,至少包含:

  • 若使用AddIdentity,需确保配置完整:
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
    .AddEntityFrameworkStores<ApplicationDbContext>()
    .AddDefaultTokenProviders();
  • 若使用AddIdentityCore,需额外手动注册UserManager、SignInManager等高层管理器,因为AddIdentityCore不会自动添加这些组件。

3. 关联ServiceStack注销逻辑与Identity服务

在ServiceStack的认证配置中,确保注销端点能正确调用DI容器中的SignInManager实例。可以在ConfigureAuth中明确配置注销处理逻辑,或确认ServiceStack的AuthFeature能正常访问ASP.NET Core DI中的Identity服务。


内容的提问来源于stack exchange,提问作者Shawn de Wet

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 13:25:55