c# - No such component has been registered in the kernel's component container -
consider code:
public class iocconfig { protected static standardkernel kernel { get; set; } public static void registerioc(httpconfiguration config) { using (ikernel kernel = new standardkernel()) { registerdependency(); config.dependencyresolver = new ninjectdependencyresolver(kernel); } } public static void registerioc() { registerdependency(); } private static void registerdependency() { if (kernel == null) { kernel = new standardkernel(); } kernel.bind<callcenterlogger>().toself().intercept().with(new timinginterceptor()); } public static t gettype<t>() { registerdependency(); return kernel.get<t>(); } }
in line:
kernel.bind<callcenterlogger>().toself().intercept().with(new timinginterceptor());
i error:
error loading ninject component iadvicefactory
no such component has been registered in kernel's component container.
suggestions:
1) if have created custom subclass kernelbase, ensure have properly
implemented addcomponents() method.
2) ensure have not removed component container via call removeall().
3) ensure have not accidentally created more 1 kernel.
how can solve it?
most have added ninject.extensions.interception not of concrete implementations ninject.extensions.interception,dynamicproxy or ninject.extensions.interception,linfu
Comments
Post a Comment