TechnitiumSoftware/DnsServer · error · DnsClientException

Invalid application configuration.

Error message

Invalid application configuration.

What it means

Thrown by LogExporterApp.InitializeAsync when AppConfig.Deserialize(config) returns null. The config string was non-null but could not be deserialised into a valid AppConfig, so the app refuses to start and raises DnsClientException. It guards the rest of initialisation from a null configuration object.

Source

Thrown at Apps/LogExporterApp/App.cs:102

                _disposed = true;
            }
        }

        #endregion

        #region public

        public Task InitializeAsync(IDnsServer dnsServer, string? config)
        {
            _dnsServer = dnsServer;

            if (config is null)
                throw new InvalidOperationException();

            _config = AppConfig.Deserialize(config);

            if (_config is null)
                throw new DnsClientException("Invalid application configuration.");

            if (_config.FileTarget!.Enabled)
            {
                _exportManager.RemoveStrategy(typeof(FileExportStrategy));
                _exportManager.AddStrategy(new FileExportStrategy(_config.FileTarget!.Path));
            }
            else
            {
                _exportManager.RemoveStrategy(typeof(FileExportStrategy));
            }

            if (_config.HttpTarget!.Enabled)
            {
                _exportManager.RemoveStrategy(typeof(HttpExportStrategy));
                _exportManager.AddStrategy(new HttpExportStrategy(_config.HttpTarget.Endpoint, _config.HttpTarget.Headers));
            }
            else
            {

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Open the LogExporterApp config string and validate it parses as JSON (no trailing commas, balanced braces).
  2. Ensure required AppConfig fields (fileTarget/httpTarget/syslogTarget blocks) are present and well-formed.
  3. Compare against the default/example LogExporterApp config and fix structural differences.
  4. Reload the app and confirm no 'Invalid application configuration' error.

Example fix

// before
{ "fileTarget" { "enabled": true, "path": "/var/log/dns" } }
// after
{ "fileTarget": { "enabled": true, "path": "/var/log/dns" } }
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrWhiteSpace(config)) throw new ConfigValidationException("LogExporterApp config is empty.");
var parsed = AppConfig.Deserialize(config);
if (parsed is null) throw new ConfigValidationException("LogExporterApp config did not deserialize — validate the JSON structure.");

Prevention

When it happens

Trigger: LogExporterApp is loaded with a config string that is syntactically present but semantically invalid for AppConfig — malformed JSON, missing required sections, or a schema the deserialiser maps to null. If config itself were null a different exception (InvalidOperationException) would fire first.

Common situations: Editing the LogExporterApp config by hand and breaking the JSON structure, a truncated/copy-pasted config, or a version mismatch where the running build expects fields the config does not provide.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/ae7ab4a5036f7b41. Report an issue: GitHub.