None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'

来源:互联网 发布:2017年8月宏观数据 编辑:程序博客网 时间:2024/05/22 00:50

这个错误是在nopcommerce中添加了一个service以后,但没有在DependencyRegistrar注册造成的。

None of the constructors found with ‘Autofac.Core.Activators.Reflection.DefaultConstructorFinder’ on type ‘*’ can be invoked with the available services and parameters:
Cannot resolve parameter ‘’ of constructor ‘Void .ctor()’.

  • DependencyRegistrar注册
   builder.RegisterType<***Service>().As<I***Service().InstancePerLifetimeScope();
  • 构造函数注入 必须注入接口,非实现

  • 接口必须有实现

0 0
原创粉丝点击