TechnitiumSoftware/DnsServer · warning · DnsServerException

DNS application does not exists: {applicationName}

Error message

DNS application does not exists: {applicationName}

What it means

Thrown by DnsApplicationManager.UnloadApplication when no application is registered under the given name (TryRemove returns false). It tells the caller the application they want to remove is not currently loaded.

Source

Thrown at DnsServerCore/Dns/Applications/DnsApplicationManager.cs:133

            if (!_applications.TryAdd(application.Name, application))
            {
                application.Dispose();
                throw new DnsServerException("DNS application already exists: " + application.Name);
            }

            application.ConfigUpdated += Application_ConfigUpdated;

            if (refreshAppObjectList)
                RefreshAppObjectLists();

            return application;
        }

        private void UnloadApplication(string applicationName)
        {
            if (!_applications.TryRemove(applicationName, out DnsApplication removedApp))
                throw new DnsServerException("DNS application does not exists: " + applicationName);

            RefreshAppObjectLists();

            removedApp.ConfigUpdated -= Application_ConfigUpdated;
            removedApp.Dispose();
        }

        private void Application_ConfigUpdated(object sender, EventArgs e)
        {
            //refresh app objects to allow sorting them as per app preference
            RefreshAppObjectLists();
        }

        private void RefreshAppObjectLists()
        {
            List<IDnsRequestController> dnsRequestControllers = new List<IDnsRequestController>(1);
            List<IDnsAuthoritativeRequestHandler> dnsAuthoritativeRequestHandlers = new List<IDnsAuthoritativeRequestHandler>(1);
            List<IDnsRequestBlockingHandler> dnsRequestBlockingHandlers = new List<IDnsRequestBlockingHandler>(1);

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Check manager.Applications.ContainsKey(name) before unloading.
  2. Treat the 'does not exist' DnsServerException as benign if unload is idempotent in your flow.
  3. Normalize the name (trim, casing) to match the registered key.
  4. Avoid concurrent unload of the same application.

Example fix

// before
manager.UnloadApplication(name); // throws if missing

// after
if (manager.Applications.ContainsKey(name))
    manager.UnloadApplication(name);
Defensive patterns

Strategy: validation

Validate before calling

if (!manager.Applications.ContainsKey(name)) return; // nothing to unload
manager.UnloadApplication(name);

Type guard

static bool ApplicationIsInstalled(DnsApplicationManager m, string name)
    => m.Applications.ContainsKey(name);

Try / catch

try { manager.UnloadApplication(name); }
catch (DnsServerException ex) when (ex.Message.Contains("does not exists"))
{ /* idempotent: already unloaded */ }

Prevention

When it happens

Trigger: Calling UnloadApplication(applicationName) for a name not in _applications: never installed, already unloaded, name typo, or a race where another caller unloaded it first.

Common situations: Retry of an unload that already succeeded, UI listing stale apps, or a mismatch between requested and registered names (case/whitespace).

Related errors


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