首页 新闻 赞助 找找看

ABP Vnext 出现 Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators

0
悬赏园豆:20 [已解决问题] 解决于 2022-06-30 17:07

调用ABP接口时出现以下异常
2022-06-24 11:41:58.983 +08:00 [ERR] An exception was thrown while activating Castle.Proxies.RedeemSuccessCodeServiceProxy.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Castle.Proxies.RedeemSuccessCodeServiceProxy.
---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Castle.Proxies.RedeemSuccessCodeServiceProxy' can be invoked with the available services and parameters:
Cannot resolve parameter 'CamBook.Domain.UserRecord.RedeemCode.IRedeemSuccessRepository redeemSuccessRepository' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], CamBook.Domain.UserRecord.RedeemCode.IRedeemSuccessRepository)'.
at Autofac.Core.Activators.Reflection.ReflectionActivator.GetAllBindings(ConstructorBinder[] availableConstructors, IComponentContext context, IEnumerable`1 parameters)

具体服务类如下:

构造函数也运行不到,直接报上面错误;

网上说没有定义DBSet,实际上已经定义了DBSet

IRedeemSuccessRepository的定义如下:

也有对应的实现类,如下:

对应的实体类定义如下:

tuohaibei的主页 tuohaibei | 初学一级 | 园豆:46
提问于:2022-06-24 12:03

已经解决了,接口和实现类要有特定的命名规则,天坑啊。
参考这里:
https://blog.csdn.net/sd7o95o/article/details/112597540

tuohaibei 1年前
< >
分享
最佳答案
0

有没有注册 IRedeemSuccessRepository 的实现 EfCoreReSuccessRepository

收获园豆:20
dudu | 高人七级 |园豆:31075 | 2022-06-24 15:10

EfCoreReSucessRepsitory已经实现这个接口了,我定义的其他服务也是用对应的类定义,反而可以调用。

tuohaibei | 园豆:46 (初学一级) | 2022-06-24 15:27

@tuohaibei: EfCoreReSucessRepsitory 怎么注册到依赖注入容器的?

dudu | 园豆:31075 (高人七级) | 2022-06-24 15:50

@dudu: 应该是abp vnext自动实现的,直接用的UseAutoFac()

tuohaibei | 园豆:46 (初学一级) | 2022-06-24 16:20

@dudu: 还是不好

tuohaibei | 园豆:46 (初学一级) | 2022-06-27 16:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册