Skip to content

Commit

Permalink
Moved directory set to the Run method so it is there from the beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
ragnarol authored Sep 25, 2017
1 parent dd7148d commit 6a61dfd
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public static class ServiceRunner<SERVICE> where SERVICE : IMicroService
{
public static int Run(Action<HostConfigurator<SERVICE>> runAction)
{
Directory.SetCurrentDirectory(PlatformServices.Default.Application.ApplicationBasePath);

var innerConfig = new HostConfiguration<SERVICE>();
innerConfig.Action = ActionEnum.RunInteractive;
innerConfig.Name = typeof(SERVICE).FullName;
Expand Down Expand Up @@ -269,7 +271,6 @@ private static void StartService(HostConfiguration<SERVICE> config, ServiceContr
{
if (!(sc.Status == ServiceControllerStatus.StartPending | sc.Status == ServiceControllerStatus.Running))
{
Directory.SetCurrentDirectory(PlatformServices.Default.Application.ApplicationBasePath);
sc.Start();
sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromMilliseconds(1000));
Console.WriteLine($@"Successfully started service ""{config.Name}"" (""{config.Description}"")");
Expand Down

0 comments on commit 6a61dfd

Please sign in to comment.