Example #1
0
 public static HostConfigurator ConfigureLogging(this HostConfigurator config, string serviceName, string machineName, string logName)
 {
     config.DependsOnEventLog();
     config.BeforeInstall(settings => CreateEventLogSource(serviceName, machineName, logName));
     config.BeforeUninstall(() => DeleteEventLogSource(serviceName, machineName));
     config.UseSerilog();
     return(config);
 }
Example #2
0
        public static ServiceConfigurator <T> WithNancyEndpoint <T>(this ServiceConfigurator <T> configurator, HostConfigurator hostconfigurator, Action <NancyServiceConfiguration> nancyConfigurator) where T : class
        {
            var nancyServiceConfiguration = new NancyServiceConfiguration();

            nancyConfigurator(nancyServiceConfiguration);

            var nancyService = new NancyService();

            nancyService.Configure(nancyServiceConfiguration);

            configurator.AfterStartingService(_ => nancyService.Start());

            configurator.BeforeStoppingService(_ => nancyService.Stop());

            hostconfigurator.BeforeInstall(_ => nancyService.BeforeInstall());

            hostconfigurator.BeforeUninstall(nancyService.BeforeUninstall);

            return(configurator);
        }
Example #3
0
        private void Configure(HostConfigurator hostOptions)
        {
            hostOptions.SetDescription("PickleJar.ServiceHost.Description");
            hostOptions.SetDisplayName("PickleJar.ServiceHost.DisplayName");
            hostOptions.SetServiceName("PickleJar.ServiceHost.ServiceName");

            hostOptions.Service <AppRootService>(ConfigureService);

            hostOptions.EnablePauseAndContinue();
            hostOptions.EnableShutdown();

            hostOptions.DependsOnEventLog();
            hostOptions.RunAsNetworkService();
            hostOptions.StartAutomaticallyDelayed();

            hostOptions.UseSerilog();

            hostOptions.OnException(SetupLogging.LogException);
            hostOptions.AfterInstall(SetupLogging.AfterInstall);
            hostOptions.BeforeUninstall(SetupLogging.BeforeUninstall);
        }