We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
一:框架版本 .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包有问题
The text was updated successfully, but these errors were encountered:
你可以修改源代码中的demo项目配置试试看是否有你目前的问题
Sorry, something went wrong.
Fix apolloconfig#224, apolloconfig#206: hot reload failed on asp.net …
7995dbf
…core 6+ mini api.
Merge pull request #225 from pengweiqhca/main
863c252
Fix #224, #206: hot reload failed on asp.net core 6+ mini api.
No branches or pull requests
一:框架版本
.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包有问题
The text was updated successfully, but these errors were encountered: