aspnet / DependencyInjection

[Archived] Contains common DI abstractions that ASP.NET Core and Entity Framework Core use. Project moved to https://github.com/aspnet/Extensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ComponentRegistrationException:

Tratcher opened this issue · comments

From @codetian on October 6, 2017 2:41

I use castle Ioc in my application ,like code example

but An error occurred while starting the application.

ComponentRegistrationException: Component Microsoft.Extensions.Options.OptionsManager`1 could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.
Castle.MicroKernel.SubSystems.Naming.DefaultNamingSubSystem.Register(IHandler handler)

ComponentRegistrationException: Component Microsoft.Extensions.Options.OptionsManager`1 could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.
Castle.MicroKernel.SubSystems.Naming.DefaultNamingSubSystem.Register(IHandler handler)
Castle.MicroKernel.DefaultKernel.AddCustomComponent(ComponentModel model)
Castle.MicroKernel.Registration.ComponentRegistration.Castle.MicroKernel.Registration.IRegistration.Register(IKernelInternal kernel)
Castle.MicroKernel.DefaultKernel.Register(IRegistration[] registrations)
Castle.Windsor.WindsorContainer.Register(IRegistration[] registrations)
BlueBlog.Utility.WindsorRegistration.Register(IWindsorContainer container, IEnumerable<ServiceDescriptor> descriptors) in WindsorRegistration.cs
+
                    container.Register(
BlueBlog.Utility.WindsorRegistration.Populate(IocContainer container, IEnumerable<ServiceDescriptor> descriptors) in WindsorRegistration.cs
+
            Register(container.Container, descriptors);
BlueBlog.Startup.ConfigureServices(IServiceCollection services) in Startup.cs
+
            container.Populate(services);
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Copied from original issue: dotnet/aspnetcore#2227

This issue was moved to dotnet/aspnetcore#2334