惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
小众软件
小众软件
The Register - Security
The Register - Security
量子位
博客园_首页
T
The Blog of Author Tim Ferriss
T
Threat Research - Cisco Blogs
G
Google Developers Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News and Events Feed by Topic
S
Security Affairs
O
OpenAI News
Google DeepMind News
Google DeepMind News
Webroot Blog
Webroot Blog
The Cloudflare Blog
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V2EX - 技术
V2EX - 技术
S
Secure Thoughts
D
Docker
Cloudbric
Cloudbric
Vercel News
Vercel News
MongoDB | Blog
MongoDB | Blog
T
Troy Hunt's Blog
Blog — PlanetScale
Blog — PlanetScale
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News and Events Feed by Topic
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
Schneier on Security
Schneier on Security
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
T
Threatpost
D
DataBreaches.Net
Spread Privacy
Spread Privacy
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tor Project blog
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
V
Vulnerabilities – Threatpost
B
Blog RSS Feed
C
Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
F
Fortinet All Blogs
The Hacker News
The Hacker News
Know Your Adversary
Know Your Adversary

博客园 - 五蕴非空

AI工具实践日记(二):在 OpenClaw 中调用 OpenCode 进行开发任务 AI工具实践日记(一):在树莓派上搭建OpenClaw,一个后端开发者的真实踩坑记录 .net core XML 解析帮助类 常用工具类 .net Core 同一接口不同实现的依赖注入 - 五蕴非空 大批量数据操作的性能优化方案 为.net Core 3.0 WebApi 创建Linux守护进程 asp.net core 3.0 JObject The collection type 'Newtonsoft.Json.Linq.JObject' is not supported .net Core2.2 WebApi通过OAuth2.0实现微信登录 Asp.net导出Excel文件 Ext.Net 使用总结之GridPanel中的选中行 Ext.Net 使用总结之查询条件中的起始日期 Ext.Net 使用总结之GridPanel的删除事件 使用 NuGet 管理项目库 JavaScript 获取客户端计算机硬件及系统信息 程序员技术练级攻略 ThoughtWorks(中国)程序员读书雷达 Sql 分割 键值对字符串 得到某值对应的名称 Ext.net 中日期格式的计算
.net core 3.1 配置文件立即更新
五蕴非空 · 2020-03-28 · via 博客园 - 五蕴非空
public class Startup
    {
        private ConfigurationReloadToken _changeToken = new ConfigurationReloadToken();
        private byte[] _configFileHash = new byte[20];

        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }
        public void ConfigureServices(IServiceCollection services)
        {
            ...
        }
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IConfiguration config)
        {
            ChangeToken.OnChange(
               () => config.GetReloadToken(),
               () =>
               {
                   byte[] configFileHash = ComputeHash("appSettings.json");

                   if (!_configFileHash.SequenceEqual(configFileHash))
                   {
                       Log.Information("Configuration changed");
                       _configFileHash = configFileHash;
                   }
                   var previousToken =
                       Interlocked.Exchange(ref _changeToken, new ConfigurationReloadToken());
                   previousToken.OnReload();
               });
        }
        private byte[] ComputeHash(string file)
        {
            if (File.Exists(file))
            {
                using (var fs = File.OpenRead(file))
                {
                    return System.Security.Cryptography.SHA1.Create().ComputeHash(fs);
                }
            }
            else
            {
                return new byte[20];
            }
        }
    }