/// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            var builder = new ContainerBuilder();

            var bootstrapper = new Bootstrapper.Bootstrapper();

            bootstrapper.Load(builder);

            GlobalConfiguration.Configuration.UseSqlServerStorage("auxiliaryDb", new SqlServerStorageOptions
            {
                //Our jobs are compile-time known, so the interval can be this long
                QueuePollInterval          = TimeSpan.FromMinutes(10),
                JobExpirationCheckInterval = TimeSpan.FromHours(3)
            })
            .UseAutofacActivator(builder.Build());

            AddJobs();

            StartOptions options = new StartOptions();

            options.Urls.Add("http://localhost:9095");
            options.Urls.Add("http://127.0.0.1:9095");
            options.Urls.Add($"http://{Environment.MachineName}:9095");

            WebApp.Start <Startup>(options);

            var servicesToRun = new ServiceBase[]
            {
                new MarriageAgencyStatistics()
            };

            ServiceBase.Run(servicesToRun);
        }
Esempio n. 2
0
        public void Configuration(IAppBuilder app)
        {
            var builder      = new ContainerBuilder();
            var bootstrapper = new Bootstrapper.Bootstrapper();

            bootstrapper.Load(builder);

            GlobalConfiguration.Configuration.UseSqlServerStorage("auxiliaryDb", new SqlServerStorageOptions
            {
                //Our jobs are compile-time known, so the interval can be this long
                QueuePollInterval          = TimeSpan.FromMinutes(10),
                JobExpirationCheckInterval = TimeSpan.FromHours(3)
            })
            .UseAutofacActivator(builder.Build());

            AddJobs();

            //TODO add authorization
            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                AuthorizationFilters = Enumerable.Empty <IAuthorizationFilter>()
            });
            app.UseHangfireServer();
        }