apolloconfig / apolloconfig/apollo.net

apollo最新版本2.8.0热更新失效问题

Offen
#206 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C#
Sterne
494
Forks
167
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

一:框架版本
.net 6.0
apollo2.8.0

二:加载apollo配置代码
program加载apollo的配置
//使用apollo
builder.Host.ConfigureAppConfiguration((context, config) =>
{
//获取环境变量
var env = context.HostingEnvironment;
//设置环境变量文件位置
config.SetBasePath(env.ContentRootPath);
//加载配置文件并刷新
//config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
//加载当前环境配置文件并刷新
config.AddJsonFile(path: $"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
//读取apollo配置
config.AddApollo(config.Build().GetSection("apollo")).AddDefault();
//加载环境变量
config.AddEnvironmentVariables();
});

三:控制器读取apollo配置
var configA = _configuration.GetSection("configA").Get();

四:问题点
apollo配置改了后,本地缓存目录能更新成功,可以发现服务端是没问题的
但是客户端一直拿的是旧实例
将版本降级到2.4.1 发现延迟一会后。立马刷新配置了
应该是apollo nuget包有问题

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.