Exemplo n.º 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);
 }
Exemplo n.º 2
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);
        }