2 Answer(s)
-
0
解决方案如下:
你的 AuthServer 只注册了 AbpIdentityProEntityFrameworkCoreModule,但没有注册 AbpIdentityProApplicationModule 或 AbpIdentityApplicationModule,导致 IIdentityUserAppService 没有被依赖注入容器注册。
你需要在 AuthServer 的模块依赖中添加 Identity 的 Application 层模块依赖。商业版推荐添加 AbpIdentityProApplicationModule,开源版添加 AbpIdentityApplicationModule。例如:
[DependsOn( // ... 其他依赖 typeof(AbpIdentityProEntityFrameworkCoreModule), typeof(AbpIdentityProApplicationModule) // 商业版 // typeof(AbpIdentityApplicationModule) // 开源版 )] public class QRSPCAuthServerModule : AbpModule { }
如果你只添加了 EntityFrameworkCore 层,Application 层的服务(如 IIdentityUserAppService)不会被注册,依赖注入会报错。
确认你的 NuGet 包已正确引用 Volo.Abp.Identity.Pro.Application(商业版)或 Volo.Abp.Identity.Application(开源版)。
重新编译并运行,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.
-
0
你不必一定要使用
IIdentityUserAppService
, 你可以注入UserManager
或者 仓储服务直接创建用户.否则你需要依赖Identity的Application模块
谢谢