mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-01-30 04:25:22 +00:00
Set Service Configuration Folder
Set service configuration folder to correct location.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the service file path has the configuration files, use it, otherwise use the localapppath folder.
|
||||
/// </summary>
|
||||
/// <returns>The configuration path.</returns>
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user