// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Log.Information("Current Dir: " + Environment.CurrentDirectory); // Add functionality to inject IOptions<T> services.AddOptions(); // Add our Config object so it can be injected services.Configure <NodeConfig>(configuration_); // Add framework services. ConfigureFrameworkServices(services); ConfigureCors(services); // Register the Swagger generator, defining one or more Swagger documents services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "bitprim", Version = "v1" }); c.IncludeXmlComments(string.Format(@"{0}/bitprim.insight.xml", System.AppDomain.CurrentDomain.BaseDirectory)); }); var serviceProvider = services.BuildServiceProvider(); webSocketHandler_ = new WebSocketHandler(serviceProvider.GetService <ILogger <WebSocketHandler> >(), nodeConfig_); webSocketHandler_.Init(); services.AddSingleton <WebSocketHandler>(webSocketHandler_); var poolInfo = new PoolsInfo(nodeConfig_.PoolsFile); poolInfo.Load(); services.AddSingleton <PoolsInfo>(poolInfo); StartNode(services, serviceProvider); }