diff --git a/FastGithub.Dns/DnsServerHostedService.cs b/FastGithub.Dns/DnsServerHostedService.cs index 1730601..6d9b40b 100644 --- a/FastGithub.Dns/DnsServerHostedService.cs +++ b/FastGithub.Dns/DnsServerHostedService.cs @@ -41,13 +41,15 @@ namespace FastGithub.Dns this.hostsValidator = hostsValidator; this.logger = logger; - if (OperatingSystem.IsWindows()) + options.OnChange(opt => { - options.OnChange(opt => SystemDnsUtil.DnsFlushResolverCache()); - } + if (OperatingSystem.IsWindows()) + { + SystemDnsUtil.DnsFlushResolverCache(); + } + }); } - /// /// 启动dns ///