;Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service ****** was found
;Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service ****** was found
在 Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext)
在 Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments)
在 Castle.Windsor.WindsorContainer.Resolve[T]()
在 Abp.Dependency.IocManager.Resolve[T]() 位置 D:\Github\aspnetboilerplate\src\Abp\Dependency\IocManager.cs:行号 179
在 Abp.Dependency.IocResolverExtensions.ResolveAsDisposable[T](IIocResolver iocResolver) 位置 D:\Github\aspnetboilerplate\src\Abp\Dependency\IocResolverExtensions.cs:行号 18
Castle.MicroKernel.ComponentNotFoundException
HResult=0x80131500
Message=No component for supporting the service was found
Source=Castle.Windsor
StackTrace:
at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext)
at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments)
at Castle.Windsor.WindsorContainer.Resolve[T]()
at Abp.Dependency.IocManager.Resolve[T]()
at Abp.Dependency.IocResolverExtensions.ResolveAsDisposable[T](IIocResolver iocResolver)
解决方法:
using (var bootstrapper = AbpBootstrapper.Create<OrderServiceModule>())
{
//bootstrapper.IocManager
// .IocContainer
// .AddFacility<LoggingFacility>(f => f.UseLog4Net().WithConfig("log4net.config"));
bootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>(f => f.UseAbpLog4Net().WithConfig(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config")));
//初始化之后再使用
bootstrapper.Initialize();
//你的业务逻辑
}