New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DependencyResolutionException when starting up. #185

Closed
Gateswong opened this Issue Oct 21, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@Gateswong

Gateswong commented Oct 21, 2018

I got the following exception when I'm starting the project:

DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Surging.Core.CPlatform.Runtime.Client.Implementation.RemoteInvokeService' can be invoked with the available services and parameters:
Cannot resolve parameter 'Surging.Core.CPlatform.Transport.ITransportClientFactory transportClientFactory' of constructor 'Void .ctor(Surging.Core.CPlatform.HashAlgorithms.IHashAlgorithm, Surging.Core.CPlatform.Runtime.Client.Address.Resolvers.IAddressResolver, Surging.Core.CPlatform.Transport.ITransportClientFactory, Microsoft.Extensions.Logging.ILogger`1[Surging.Core.CPlatform.Runtime.Client.Implementation.RemoteInvokeService], Surging.Core.CPlatform.Runtime.Client.HealthChecks.IHealthCheckService)'.

Program.cs - Main():

var consulConfigInfo = new ConfigInfo("127.0.0.1:8500");

var host = new ServiceHostBuilder()
    .RegisterServices(builder =>
    {
        builder.AddMicroService(option =>
        {
            option.AddServiceRuntime();
            option.AddRelateService();
            option.AddConfigurationWatch();

            // option.UseConsulManager(new ConfigInfo("127.0.0.1:8500"));
            option.UseConsulRouteManager(consulConfigInfo);
            option.UseConsulServiceSubscribeManager(consulConfigInfo);
            option.UseConsulCommandManager(consulConfigInfo);
            option.UseConsulCacheManager(consulConfigInfo);
            option.UseConsulWatch(consulConfigInfo);

            option.UseRabbitMQTransport();
            option.AddRabbitMQAdapt();

            builder.Register(p => new CPlatformContainer(ServiceLocator.Current));
        });
    })
    .SubscribeAt()
    .UseServer(options =>
    {
        options.Ip = "127.0.0.1";
        options.Port = 98;
        options.ExecutionTimeoutInMilliseconds = 30000; //执行超时时间
    })
    //.UseNLog(LogLevel.Error)// 使用NLog 记录日志
    .Configure(builder => builder.AddEventBusFile("eventBusSettings.json", optional: false))
    .UseProxy()
    .UseStartup<Startup>()
    .Build();

using (host.Run())
{
    Console.WriteLine($"Service started successfully!, {DateTime.Now}");
}

Startup.cs

    public class Startup : IStartup
    {
        public IContainer ConfigureServices(ContainerBuilder builder)
        {
            builder.RegisterType<WikiService>().As<IWikiService>();

            ServiceLocator.Current = builder.Build();
            return ServiceLocator.Current;
        }

        public void Configure(IContainer app)
        {
            
        }
    }
@fanliang11

This comment has been minimized.

Member

fanliang11 commented Oct 21, 2018

No need to add component configuration,Run directly according to the configuration in the Program.cs code in Server and client

@Gateswong

This comment has been minimized.

Gateswong commented Oct 26, 2018

No need to add component configuration,Run directly according to the configuration in the Program.cs code in Server and client

What is the component you referring here? Can you provide more detail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment