@@ -5,6 +5,7 @@ namespace Particular.ServiceControl
55 using System . IO ;
66 using System . ServiceProcess ;
77 using Autofac ;
8+ using Hosting ;
89 using NLog ;
910 using NLog . Config ;
1011 using NLog . Layouts ;
@@ -20,14 +21,14 @@ public class Bootstrapper
2021 IStartableBus bus ;
2122 public static IContainer Container { get ; set ; }
2223
23- public Bootstrapper ( ServiceBase host = null )
24+ public Bootstrapper ( ServiceBase host = null , HostArguments hostArguments = null )
2425 {
25- Settings . ServiceName = DetermineServiceName ( host ) ;
26+ Settings . ServiceName = DetermineServiceName ( host , hostArguments ) ;
2627 ConfigureLogging ( ) ;
2728 var containerBuilder = new ContainerBuilder ( ) ;
28-
29+
2930 Container = containerBuilder . Build ( ) ;
30-
31+
3132 // Disable Auditing for the service control endpoint
3233 Configure . Features . Disable < Audit > ( ) ;
3334 Configure . Features . Enable < Sagas > ( ) ;
@@ -112,8 +113,15 @@ static void ConfigureLogging()
112113 LogManager . Configuration = nlogConfig ;
113114 }
114115
115- string DetermineServiceName ( ServiceBase host )
116+ string DetermineServiceName ( ServiceBase host , HostArguments hostArguments )
116117 {
118+ //if Arguments not null then bootstrapper was run from installer so use servicename passed to the installer
119+ if ( hostArguments != null )
120+ {
121+ return hostArguments . ServiceName ;
122+ }
123+
124+ // Try to get HostName from Windows Service Name, default to "Particular.ServiceControl"
117125 if ( ( host == null ) || ( string . IsNullOrWhiteSpace ( host . ServiceName ) ) )
118126 {
119127 return "Particular.ServiceControl" ;
0 commit comments