public ApplicationLifecycle(IApplicationLifetime lifeCycle, IDiscoveryClient client) { ApplicationStopping = lifeCycle.ApplicationStopping; // hook things up so that that things are unregistered when the application terminates ApplicationStopping.Register(() => { client.ShutdownAsync().GetAwaiter().GetResult(); }); }
internal async Task ProvideRuntimeReplacementsAsync(IDiscoveryClient discoveryClientFromDI, ILoggerFactory loggerFactory) { if (discoveryClientFromDI is not null) { _logger.LogInformation("Replacing the IDiscoveryClient built at startup with one for runtime"); await _discoveryClient.ShutdownAsync().ConfigureAwait(false); _discoveryClient = discoveryClientFromDI; _usingInitialDiscoveryClient = false; } if (loggerFactory is not null) { _logFactory = loggerFactory; _logger = loggerFactory.CreateLogger <ConfigServerDiscoveryService>(); } }
protected void Application_End() { //释放客户端 _client.ShutdownAsync(); }
protected void Application_End() { // Unregister current app with Service Discovery server _client.ShutdownAsync(); }
public Task StopAsync(CancellationToken cancellationToken) { return(_discoveryClient.ShutdownAsync()); }