예제 #1
0
        public void Configuration(IAppBuilder app)
        {
            var container = WebAutofac.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

            AuthConfig.ConfigureAuth(app);

            // HangFire setup...
            //
            HangFireConfig.ConfigureStorage();

            app.UseHangfireDashboard(
                "/hangfire",
                new DashboardOptions
            {
                Authorization = new[] { new HangFireAuthorizationFilter(), },
                AppPath       = GlobalConfig.LoginPage,
            });
        }
예제 #2
0
        public static void RunHangFireBackgroundService()
        {
            var container = AutofacBuilder.BuildContainer(sentryEnabled: true);

            // Configure Hangfire for Background Job
            //
            HangFireConfig.ConfigureStorage();

            GlobalConfiguration.Configuration.UseAutofacActivator(container);
            LogProvider.SetCurrentLogProvider(new HangfireLogProvider());

            var options = new BackgroundJobServerOptions()
            {
                SchedulePollingInterval = new TimeSpan(0, 0, 0, 1),
                WorkerCount             = ConfigurationManager.AppSettings["HangFireWorkerCount"].ToIntegerAlt(10),
            };

            using (var server = new BackgroundJobServer(options))
                using (SentrySdk.Init("https://[email protected]/5202882"))
                {
                    Console.WriteLine("Hangfire Server started. Press any key to exit...");
                    Console.ReadKey();
                }
        }