TechnitiumSoftware/DnsServer · critical · FileNotFoundException

MaxMind City file is missing!

Error message

MaxMind City file is missing!

What it means

Thrown by the GeoDistanceApp MaxMind constructor when neither GeoIP2-City.mmdb nor GeoLite2-City.mmdb exists in ApplicationFolder. Note this is the City database, not Country: GeoDistanceApp needs city-level coordinates to compute distance. FileNotFoundException at construction; it is the upstream cause of errors 32 and 33.

Source

Thrown at Apps/GeoDistanceApp/MaxMind.cs:49

        static MaxMind? _maxMind;

        readonly DatabaseReader _mmCityReader;
        readonly DatabaseReader? _mmIspReader;
        readonly DatabaseReader? _mmAsnReader;

        #endregion

        #region constructor

        private MaxMind(IDnsServer dnsServer)
        {
            string mmCityFile = Path.Combine(dnsServer.ApplicationFolder, "GeoIP2-City.mmdb");

            if (!File.Exists(mmCityFile))
                mmCityFile = Path.Combine(dnsServer.ApplicationFolder, "GeoLite2-City.mmdb");

            if (!File.Exists(mmCityFile))
                throw new FileNotFoundException("MaxMind City file is missing!");

            _mmCityReader = new DatabaseReader(mmCityFile);

            string mmIspFile = Path.Combine(dnsServer.ApplicationFolder, "GeoIP2-ISP.mmdb");
            if (File.Exists(mmIspFile))
            {
                _mmIspReader = new DatabaseReader(mmIspFile);
                return;
            }

            string mmAsnFile = Path.Combine(dnsServer.ApplicationFolder, "GeoLite2-ASN.mmdb");
            if (File.Exists(mmAsnFile))
                _mmAsnReader = new DatabaseReader(mmAsnFile);
        }

        #endregion

        #region IDisposable

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Download GeoLite2-City.mmdb (or GeoIP2-City.mmdb) from MaxMind — note this is a different, larger file than the Country database.
  2. Copy it into the DNS server ApplicationFolder.
  3. Restart the DnsServer process so the MaxMind constructor finds it.
Defensive patterns

Strategy: validation

Validate before calling

string folder = dnsServer.ApplicationFolder;
string[] candidates = { Path.Combine(folder,"GeoIP2-City.mmdb"), Path.Combine(folder,"GeoLite2-City.mmdb") };
if (!candidates.Any(File.Exists))
    throw new ConfigValidationException("GeoDistanceApp requires GeoIP2-City.mmdb or GeoLite2-City.mmdb in: " + folder);

Prevention

When it happens

Trigger: GeoDistanceApp initialisation looks for the commercial City database first, falls back to GeoLite2-City.mmdb, and throws if both are absent. Reached at server/app startup or reload.

Common situations: Operator deployed the Country database (used by other geo apps) but forgot GeoDistanceApp needs the larger City database; container image missing the City .mmdb; or file deleted.

Related errors


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