Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am in .NETcore 3.0 and using a Nuget package created in .Net Framework 4.7.2

I wanted to something like this:
services.Configure<IAuthenticationConfig>(c => AuthenticationConfig.Create(Configuration.GetSection("authorisation").ToString()));


services.AddSingleton<IAuthenticationProcessor, AuthenticationProcessor>();


AuthenticationConfig Only accepts Web.config section but in .NET Core I am using appsetting.json and created the same section.

When I am starting to run the project I am getting an error like this:


An error occurred while starting the application.
AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: RAPP.Authentication.OpenID.IAuthenticationProcessor Lifetime: Singleton ImplementationType: RAPP.Authentication.OpenID.AuthenticationProcessor': Unable to resolve service for type 'RAPP.Authentication.OpenID.Managers.IAuthenticationManagerFactory' while attempting to activate 'RAPP.Authentication.OpenID.AuthenticationProcessor'.)
Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable<ServiceDescriptor> serviceDescriptors, ServiceProviderOptions options)

InvalidOperationException: Error while validating the service descriptor 'ServiceType: RAPP.Authentication.OpenID.IAuthenticationProcessor Lifetime: Singleton ImplementationType: RAPP.Authentication.OpenID.AuthenticationProcessor': Unable to resolve service for type 'RAPP.Authentication.OpenID.Managers.IAuthenticationManagerFactory' while attempting to activate 'RAPP.Authentication.OpenID.AuthenticationProcessor'.
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.ValidateService(ServiceDescriptor descriptor)

AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: RAPP.Authentication.OpenID.IAuthenticationProcessor Lifetime: Singleton ImplementationType: RAPP.Authentication.OpenID.AuthenticationProcessor': Unable to resolve service for type 'RAPP.Authentication.OpenID.Managers.IAuthenticationManagerFactory' while attempting to activate 'RAPP.Authentication.OpenID.AuthenticationProcessor'.)
Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable<ServiceDescriptor> serviceDescriptors, ServiceProviderOptions options)
Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder)
Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter<TContainerBuilder>.CreateServiceProvider(object containerBuilder)
Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
Microsoft.Extensions.Hosting.HostBuilder.Build()
Gas_Gateway.Program.Main(string[] args) in Program.cs
+ 
namespace Gas_Gateway
                                                    {
                                                        public class Program
                                                        {
                                                            public static void Main(string[] args)
                                                            {
                                                        CreateHostBuilder(args).Build().Run();
                                                }
                                                    
                                                            public static IHostBuilder CreateHostBuilder(string[] args) =>
                                                                Host.CreateDefaultBuilder(args)
                                                                    .ConfigureWebHostDefaults(webBuilder =>
                                                                    {


If someone please let me know how Can I initialize the appsetting.json in this scenario that would be great.

Thank you in advance


What I have tried:

not sure what to do in this case
Posted
Comments
Richard Deeming 18-Dec-19 12:53pm    
Looks like you've forgotten to configure your IAuthenticationManagerFactory service.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900