Open Closed

AuthServer 中配置了单点登录OAuth2.0 模式 校验用户是否存在本系统中时 用到了IIdentityUserAppService 但是无法完成注册 #10018


User avatar
0
2250368121 created
  • Steps to reproduce the issue: 进行单点登录测试时 查询新增用户时用到了IIdentityUserAppService 但是提示未注册 商业版的可以注册AbpIdentityProEntityFrameworkCoreModule 但是无法注册 AbpIdentityProApplicationModule 请问这该怎么解决

2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    解决方案如下:

    1. 你的 AuthServer 只注册了 AbpIdentityProEntityFrameworkCoreModule,但没有注册 AbpIdentityProApplicationModule 或 AbpIdentityApplicationModule,导致 IIdentityUserAppService 没有被依赖注入容器注册。

    2. 你需要在 AuthServer 的模块依赖中添加 Identity 的 Application 层模块依赖。商业版推荐添加 AbpIdentityProApplicationModule,开源版添加 AbpIdentityApplicationModule。例如:

    [DependsOn(
        // ... 其他依赖
        typeof(AbpIdentityProEntityFrameworkCoreModule),
        typeof(AbpIdentityProApplicationModule) // 商业版
        // typeof(AbpIdentityApplicationModule) // 开源版
    )]
    public class QRSPCAuthServerModule : AbpModule
    {
    }
    
    1. 如果你只添加了 EntityFrameworkCore 层,Application 层的服务(如 IIdentityUserAppService)不会被注册,依赖注入会报错。

    2. 确认你的 NuGet 包已正确引用 Volo.Abp.Identity.Pro.Application(商业版)或 Volo.Abp.Identity.Application(开源版)。

    3. 重新编译并运行,IIdentityUserAppService 就可以被正常注入和使用。

    参考文档:


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    你不必一定要使用IIdentityUserAppService, 你可以注入UserManager 或者 仓储服务直接创建用户.

    否则你需要依赖Identity的Application模块

    谢谢

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 20, 2025, 13:25