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