diff --git a/DnsService/DnsService.cs b/DnsService/DnsService.cs
index 9879082b..8982f463 100644
--- a/DnsService/DnsService.cs
+++ b/DnsService/DnsService.cs
@@ -34,10 +34,25 @@ namespace DnsService
protected override void OnStart(string[] args)
{
- _service = new WebService(null, new Uri("https://go.technitium.com/?id=22"));
+ _service = new WebService(getConfigFolder(), new Uri("https://go.technitium.com/?id=22"));
_service.Start();
}
+ ///
+ /// If the service file path has the configuration files, use it, otherwise use the localapppath folder.
+ ///
+ /// The configuration path.
+ private string getConfigFolder()
+ {
+ string userConfigFolder = String.Concat(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"\Technitium\DNSServer");
+
+ if (System.IO.Directory.Exists(Environment.CurrentDirectory))
+ {
+ return Environment.CurrentDirectory;
+ }
+ return userConfigFolder;
+ }
+
protected override void OnStop()
{
_service.Dispose();