当前位置: 首页>>代码示例>>C#>>正文


C# IAppBuilder.UseHangfireServer方法代码示例

本文整理汇总了C#中IAppBuilder.UseHangfireServer方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseHangfireServer方法的具体用法?C# IAppBuilder.UseHangfireServer怎么用?C# IAppBuilder.UseHangfireServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAppBuilder的用法示例。


在下文中一共展示了IAppBuilder.UseHangfireServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigureHangFire

      public void ConfigureHangFire(IAppBuilder app)
      {
         var storageOptions = new SqlServerStorageOptions
         {
            InvisibilityTimeout = TimeSpan.FromHours(2),
            QueuePollInterval = TimeSpan.FromMinutes(15.0)
         };
         GlobalConfiguration.Configuration
            .UseSqlServerStorage("TrainingManagerDb", storageOptions);

         // case msmq installed
         /*GlobalConfiguration.Configuration
            .UseSqlServerStorage("TrainingManagerDb")
            .UseMsmqQueues(@".\hangfire-{0}");*/



         var dashboardOptions = new DashboardOptions
         {
            AuthorizationFilters = new[] { new AuthorizationFilter { Roles = AppConstants.UserRole.Administrator } }
         };
         app.UseHangfireDashboard("/hangfire", dashboardOptions);


         var jobServerOptions = new BackgroundJobServerOptions
         {
            WorkerCount = 1
         };
         app.UseHangfireServer(jobServerOptions);

         RecurringJob.AddOrUpdate(() => UpdateDaemon.ScheduledCatalogsUpdate(), Cron.Hourly);
      }
开发者ID:ssh-git,项目名称:training-manager,代码行数:32,代码来源:OwinConfig.cs

示例2: ConfigureOwin

        public void ConfigureOwin(IAppBuilder app, IUnityContainer container)
        {
            JobStorage.Current = CreateJobStorage(Stage.ConfigureOwin);

            // Configure Hangfire dashboard

            var securityService = container.Resolve<ISecurityService>();
            var moduleInitializerOptions = container.Resolve<IModuleInitializerOptions>();

            var appPath = "/" + moduleInitializerOptions.RoutePrefix;

            var authorizationFilters = new[]
            {
                    new PermissionBasedAuthorizationFilter(securityService)
                    {
                        Permission = PredefinedPermissions.BackgroundJobsManage
                    }
                };

            var dashboardOptions = new DashboardOptions
            {
                AppPath = appPath,
                AuthorizationFilters = authorizationFilters
            };

            app.UseHangfireDashboard(appPath + "hangfire", dashboardOptions);

            // Configure Hangfire server
            if (_options.StartServer)
            {
                app.UseHangfireServer(new BackgroundJobServerOptions { Activator = new UnityJobActivator(container) });
            }
        }
开发者ID:sameerkattel,项目名称:vc-community,代码行数:33,代码来源:HangfireLauncher.cs

示例3: Configuration

        public void Configuration(IAppBuilder app)
        {

            var authorizationFilter = new BasicAuthAuthorizationFilter(
                                new BasicAuthAuthorizationFilterOptions
                                {
                                    // Require secure connection for dashboard
                                    RequireSsl = true,
                                    // Case sensitive login checking
                                    LoginCaseSensitive = true,
                                    // Users
                                    Users = new[]
                                    {
                                        new BasicAuthAuthorizationUser
                                        {
                                            Login = "[email protected]",
                                            PasswordClear = "passW0rd!"
                                        }
                                    }
                                });

            var options = new DashboardOptions
            {
                AuthorizationFilters = new IAuthorizationFilter[]
                {
                    authorizationFilter
                }
            };
            GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");

            app.UseHangfireDashboard("/hangfire", options);
            app.UseHangfireServer();

            ConfigureAuth(app);
        }
开发者ID:mangapi,项目名称:Scheduler-app-Version1.0.0,代码行数:35,代码来源:Startup.cs

示例4: Configuration

        public void Configuration(IAppBuilder app)
        {
            HangfireConfiguration.Register();

            var options = new DashboardOptions
            {
                AuthorizationFilters = new []
                {
                    new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions
                    {
                        RequireSsl = true,
                        LoginCaseSensitive = true,
                        Users = new []
                        {
                            new BasicAuthAuthorizationUser
                            {
                                Login = "[email protected]",
                                PasswordClear = "D3v3L0pM3nT"
                            }
                        }
                    }),
                }
            };

            app.UseHangfireDashboard("/hangfire", options);
            app.UseHangfireServer();
        }
开发者ID:letmeproperty,项目名称:Properties,代码行数:27,代码来源:Startup.cs

示例5: Configuration

        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration();
            config.MapHttpAttributeRoutes();
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            config.EnableSwagger("help/{apiVersion}", c =>
            {
                c.IncludeXmlComments("Slight.WeMo.Service.XML");
                c.SingleApiVersion("v1", "Slight.WeMo REST Api");
            }).EnableSwaggerUi("help/ui/{*assetPath}");
            app.UseWebApi(config);

            GlobalConfiguration.Configuration.UseMemoryStorage();
            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                AuthorizationFilters = new IAuthorizationFilter[] { new AllowAllFilter() }
            });
            app.UseHangfireServer();

            app.Use(async (context, func) =>
            {
                if (new[] { "/", "/help" }.Any(x => context.Request.Path.Value.StartsWith(x)))
                {
                    context.Response.Redirect("/help/ui/index");
                    return;
                }
                await func.Invoke();
            });
        }
开发者ID:Silvenga,项目名称:Slight.WeMo,代码行数:29,代码来源:Startup.cs

示例6: ConfigureHangfire

        public static void ConfigureHangfire(IAppBuilder app)
        {
            GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");

            app.UseHangfireDashboard("/jobs");
            app.UseHangfireServer();
        }
开发者ID:Apatruno,项目名称:HelpOut,代码行数:7,代码来源:Hangfire.cs

示例7: InitHangfire

        private void InitHangfire(IAppBuilder app)
        {
            var hangfireConfig = IoC.Container.Resolve<IHangfireConfig>();
            GlobalConfiguration.Configuration.UseSqlServerStorage(
                hangfireConfig.SqlServerConnectionString,
                new SqlServerStorageOptions()
                {
                    PrepareSchemaIfNecessary = true,
                    QueuePollInterval = TimeSpan.FromSeconds(1)
                });
            GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 3 });

            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                AuthorizationFilters = new[] { new MyRestrictiveAuthorizationFilter() }
            });

            LogProvider.SetCurrentLogProvider(new ElmahLogProvider(LogLevel.Trace));

            var options = new BackgroundJobServerOptions
            {
                WorkerCount = Environment.ProcessorCount * 5
            };
            app.UseHangfireServer(options);

        }
开发者ID:mariusmuntean,项目名称:DepthView,代码行数:26,代码来源:Startup.cs

示例8: Configuration

        public static void Configuration(IAppBuilder app)
        {
            // Enable the application to use a cookie to store information for the signed in user.
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/")
            });

            // Enable the application to use a cookie to store information about a user logging
            // in with a third party login provider. 
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Enable the Reddit authentication provider.
            app.UseRedditAuthentication(GetRedditOptions());

            GlobalConfiguration.Configuration.UseSqlServerStorage("Hangfire");
            app.UseHangfireDashboard("/Hangfire", new DashboardOptions
            {
                AuthorizationFilters = new[] {new HangfireDashboardAuthorizationFilter(),}
            });
            app.UseHangfireServer();

            RecurringJob.AddOrUpdate<BulkFlairUpdateJob>(FlairJobId, job => job.Execute(), Cron.Minutely);
            RecurringJob.AddOrUpdate<BulkLeagueUpdateJob>(LeagueJobId, job => job.Execute(), Cron.Minutely);
        }
开发者ID:Bringan,项目名称:RedditRankedFlairs,代码行数:26,代码来源:OwinStartup.cs

示例9: Configuration

            public void Configuration(IAppBuilder app)
            {
                GlobalConfiguration.Configuration
                    .UseSqlServerStorage(@"<your_connection_string>");

                app.UseHangfireServer();
                app.UseHangfireDashboard();
            }
开发者ID:HangfireIO,项目名称:Hangfire.Api,代码行数:8,代码来源:AppBuilderExtensions.cs

示例10: Configuration

        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
            GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");

            app.UseHangfireDashboard();
            app.UseHangfireServer();
        }
开发者ID:kahneraja,项目名称:HangfireGarden,代码行数:8,代码来源:Startup.cs

示例11: Configuration

        public void Configuration(IAppBuilder app)
        {
            GlobalConfiguration.Configuration
                .UseSqlServerStorage("CoopCheck");

            app.UseHangfireDashboard();
            app.UseHangfireServer();
        }
开发者ID:FrankMedvedik,项目名称:coopcheck,代码行数:8,代码来源:Startup.cs

示例12: Configuration

 public void Configuration(IAppBuilder app)
 {
     //Reference connection string for data base of hangfire
     GlobalConfiguration.Configuration.UseSqlServerStorage("myConnectionString");
     app.UseHangfireServer();
     //activate dashboard of hangfire in application
     app.UseHangfireDashboard();
 }
开发者ID:wenderdalber,项目名称:ApplicationMVCWIthHangfire,代码行数:8,代码来源:Startup.cs

示例13: Configuration

        public void Configuration(IAppBuilder app)
        {
            string ConnectionString = ConfigurationManager.ConnectionStrings["dataSocket"].ConnectionString;
            ConfigureAuth(app);
            GlobalConfiguration.Configuration.UseSqlServerStorage(ConnectionString);

            app.UseHangfireDashboard();
            app.UseHangfireServer();
        }
开发者ID:Gcobani,项目名称:project-insight,代码行数:9,代码来源:Startup.cs

示例14: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR();

            GlobalConfiguration.Configuration.UseMemoryStorage();

            app.UseHangfireDashboard();
            app.UseHangfireServer();
        }
开发者ID:sandermvanvliet,项目名称:BuildMonitor,代码行数:9,代码来源:Startup.cs

示例15: Configuration

 public void Configuration(IAppBuilder app)
 {
     // 如需如何設定應用程式的詳細資訊,請參閱  http://go.microsoft.com/fwlink/?LinkID=316888
     // 指定Hangfire使用記憶體儲存任務
     GlobalConfiguration.Configuration.UseMemoryStorage();
     // 啟用HanfireServer
     app.UseHangfireServer();
     // 啟用Hangfire的Dashboard
     app.UseHangfireDashboard();
 }
开发者ID:xavierchen2015,项目名称:HangfireTest,代码行数:10,代码来源:Startup.cs


注:本文中的IAppBuilder.UseHangfireServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。