Reputation: 61
I have a large blazor server app that i have been building for a few years and it is now too big and unwieldy. So i want to create new functionality in standalone projects that can be built and tested independently. I then want to add these projects to the main solution and use the components of the child projects in the main project.
I have created a working child which uses the same azure db and the same security protocol but when i try to incorporate it as a custom component i run into problems with the security
System.AggregateException
HResult=0x80131500
Message=Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: ChildProject.SecurityService Lifetime: Transient ImplementationType: Kanban.SecurityService': Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager1[ChildProject.Models.ApplicationUser]' while attempting to activate 'ChildProject.SecurityService'.) (Error while validating the service descriptor 'ServiceType: ChildProject.AccountController Lifetime: Transient ImplementationType: ChildProject.AccountController': Unable to resolve service for type 'Microsoft.AspNetCore.Identity.SignInManager
1[ChildProject.Models.ApplicationUser]' while attempting to activate 'ChildProject.AccountController'.)
Source=Microsoft.Extensions.DependencyInjection
StackTrace:
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
at Microsoft.Extensions.Hosting.HostBuilder.InitializeServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Parent.Program.Main(String[] args) in C:\Users\john\source\repos\Parent - v8\server\Program.cs:line 18
This exception was originally thrown at this call stack: [External Code]
Inner Exception 1: InvalidOperationException: Error while validating the service descriptor 'ServiceType: ChildProject.SecurityService Lifetime: Transient ImplementationType: ChildProject.SecurityService': Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager`1[ChildProject.Models.ApplicationUser]' while attempting to activate 'ChildProject.SecurityService'.
Inner Exception 2: InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager
1[ChildProject.Models.ApplicationUser]' while attempting to activate 'ChildProject.SecurityService'.
`
I have tried adding the services from the ChildProject into the startup of the main project but still get this error.
How can I solve this error?
Is this even the right way to achieve the main aim to have a parent and 'n' children in the solution?
Thanks
John
Upvotes: 0
Views: 30