{"record":{"id":"bc91cb2591b10788","repo":"TechnitiumSoftware/DnsServer","slug":"web-service-tls-certificate-file-does-not-exists","errorCode":null,"errorMessage":"Web Service TLS certificate file does not exists: {tlsCertificatePath}","messagePattern":"Web Service TLS certificate file does not exists: (.+?)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/DnsWebService.cs","lineNumber":2685,"sourceCode":"                }, null, TLS_CERTIFICATE_UPDATE_TIMER_INITIAL_INTERVAL, TLS_CERTIFICATE_UPDATE_TIMER_INTERVAL);\n            }\n        }\n\n        private void StopTlsCertificateUpdateTimer()\n        {\n            if (_tlsCertificateUpdateTimer is not null)\n            {\n                _tlsCertificateUpdateTimer.Dispose();\n                _tlsCertificateUpdateTimer = null;\n            }\n        }\n\n        private void LoadWebServiceTlsCertificate(string tlsCertificatePath, string tlsCertificatePassword)\n        {\n            FileInfo fileInfo = new FileInfo(tlsCertificatePath);\n\n            if (!fileInfo.Exists)\n                throw new ArgumentException(\"Web Service TLS certificate file does not exists: \" + tlsCertificatePath);\n\n            switch (Path.GetExtension(tlsCertificatePath).ToLowerInvariant())\n            {\n                case \".pfx\":\n                case \".p12\":\n                    break;\n\n                default:\n                    throw new ArgumentException(\"Web Service TLS certificate file must be PKCS #12 formatted with .pfx or .p12 extension: \" + tlsCertificatePath);\n            }\n\n            X509Certificate2Collection certificateCollection = X509CertificateLoader.LoadPkcs12CollectionFromFile(tlsCertificatePath, tlsCertificatePassword, X509KeyStorageFlags.PersistKeySet);\n            X509Certificate2 serverCertificate = null;\n\n            foreach (X509Certificate2 certificate in certificateCollection)\n            {\n                if (certificate.HasPrivateKey)\n                {","sourceCodeStart":2667,"sourceCodeEnd":2703,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/DnsWebService.cs#L2667-L2703","documentation":"ArgumentException thrown by LoadWebServiceTlsCertificate when FileInfo.Exists is false for the supplied TLS certificate path. The loader refuses to proceed because there is no file to read the PFX/P12 from.","triggerScenarios":"Calling SetWebServiceTlsCertificate (or startup config load) with a path that does not exist on disk, or where the service account lacks permission to stat the file.","commonSituations":"Typo in the certificate path; certificate deployed to a different node/folder; relative path resolved against the wrong working directory; service account lacks read/list permissions; cert was rotated and the old path removed; container volume not mounted.","solutions":["Verify the path exists and is readable by the service account (check the absolute path after ConvertToAbsolutePath).","Place the .pfx/.p12 in the configured certificate folder and update the config to point at it.","For containers, ensure the certificate volume/file is mounted at the expected path.","Grant the service account read permission on the certificate file."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"string absPath = Path.GetFullPath(webServiceTlsCertificatePath);\nif (!File.Exists(absPath))\n    throw new FileNotFoundException(\"TLS certificate file not found.\", absPath);\n_dnsWebService.SetWebServiceTlsCertificate(absPath, password);","typeGuard":"static bool CertificateFileExists(string path) => File.Exists(path);","tryCatchPattern":"catch (ArgumentException ex) when (ex.Message.Contains(\"does not exists\"))\n{\n    // deploy/mount the certificate, then retry\n}","preventionTips":["Store certificates in a fixed, well-known folder.","For containers, mount the certificate volume at the configured path.","Grant the service account read access to the certificate file."],"tags":["dns-server","technitium","tls","certificate","configuration","filesystem","csharp"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}