0
我已经使用下面的链接进行城堡windsor依赖注入。我无法注册该组件。无法注册城堡windsor中的组件
http://www.codeproject.com/Tips/1052382/ASP-NET-MVC-Dependency-Injection-using-Windsor#_comments
public class ServiceInstaller : IWindsorInstaller
{
public void Install(Castle.Windsor.IWindsorContainer container,
Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{
container.Register(
Component.For<Interfaces.TestInterface>()
.ImplementedBy<Services.TestServices>()
.LifestyleTransient());
}
}
的ErrorMessage:
的类型 'Castle.MicroKernel.ComponentRegistrationException' 的异常出现在 Castle.Windsor.dll但在用户代码中没有处理
附加信息:组件 TestForCastleWindsor.Services.TestServices could n不被注册。 已经有一个具有该名称的组件。您是否想要修改 现有组件?如果不是,请确保您指定一个唯一的 名称。
您确定您还没有在其他地方注册组件吗?您在任何地方的注册管道上没有任何定制? – Charleh
我还没有在其他地方注册的组件 – user2465036
公共类ControllersInstaller:。IWindsorInstaller { 公共无效安装(IWindsorContainer容器,IConfigurationStore店) { container.Register( 类 FromThisAssembly() 支持算法FMP() 如果(c => c.Name.EndsWith(“Controller”))。 LifestyleTransient()); ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container)); } } –
user2465036