Skip to content

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

@fc200

Description

@fc200

一:框架版本
.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包有问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions