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


C# IAppBuilder.UseHangfire方法代码示例

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


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

示例1: Configuration

        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);

            app.UseHangfire(config =>
            {
                config.UseSqlServerStorage("Hangfire");
                config.UseServer();

                //config.UseAuthorizationFilters(new AuthorizationFilter
                //{
                //    Users = "admin, superuser", // allow only specified users
                //    Roles = "admins" // allow only specified roles
                //});

                //// or

                //config.UseAuthorizationFilters(
                //    new ClaimsBasedAuthorizationFilter("hangfire", "access"));
            });

            app.MapSignalR();

            MessageSender.NotifyCompleted = SentNotification.Notify;
        }
开发者ID:yonglehou,项目名称:MailSender,代码行数:25,代码来源:Startup.cs

示例2: ConfigurationJob

       public void ConfigurationJob(IAppBuilder app)
       {

    

           var options = new BackgroundJobServerOptions
           {
               ServerName = String.Format(
                   "{0}.{1}",
                   CommonHelper.GetApplicationName, Environment.MachineName )

				        
           };
          var jobStorage = new SqlServerStorage(CommonHelper.GetJobConnectionString);
         
        //   var server = new BackgroundJobServer(options, jobStorage);

           app.UseHangfire(config =>
           {
               config.UseSqlServerStorage(CommonHelper.GetJobConnectionString);



               //var server = new BackgroundJobServer(options);
               config.UseServer(options);

               if (CommonHelper.EnableRemoteHangfire)
               config.UseAuthorizationFilters(new HangFireRestrictiveAuthorizationFilter());


           });
          // BackgroundJob.Enqueue(() => Debug.WriteLine("Hello, world!"));
       }
开发者ID:surifoll,项目名称:git-test,代码行数:33,代码来源:Startup.Job.cs

示例3: Configuration

 public void Configuration(IAppBuilder app)
 {
     app.UseHangfire(config =>
     {
         config.UseSqlServerStorage(ConfigurationManager.ConnectionStrings["ApiDataContext"].ConnectionString);
         config.UseServer();
     });
 }
开发者ID:neilb14,项目名称:featurewise,代码行数:8,代码来源:Startup.cs

示例4: Configuration

 public void Configuration(IAppBuilder app)
 {
     app.UseHangfire(config =>
     {
         config.UseSqlServerStorage("JobHangFireIoDb");
         config.UseServer();
     });
 }
开发者ID:Code2Read,项目名称:PruebaConcepto,代码行数:8,代码来源:Starup.cs

示例5: Configuration

        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);

            app.UseHangfire(config =>
            {
                config.UseSqlServerStorage("DataContext").UseMsmqQueues(@".\private$\hangfire-0");

            });
        }
开发者ID:BazookaDeploy,项目名称:Bazooka,代码行数:10,代码来源:Startup.cs

示例6: ConfigureHangfire

 public static void ConfigureHangfire(IAppBuilder app)
 {
     app.UseHangfire(config =>
     {
         config.UseSqlServerStorage("HangfireStorageDbContext");
         config.UseServer();
         config.UseDashboardPath("/dashboard");
         config.UseAuthorizationFilters(); //allow all users to access the dashboard
     });
 }
开发者ID:shichico,项目名称:hangfire,代码行数:10,代码来源:Hangfire.cs

示例7: Configuration

 public void Configuration(IAppBuilder app)
 {
     // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
     app.UseHangfire(config =>
     {
         //config.UseSqlServerStorage(@"Data Source=t55kxp502o.database.windows.net;Initial Catalog=DBLacage;Integrated Security=False;User ID=lacagek;Password=JgE7Wofm;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False");
         config.UseSqlServerStorage(@"Data Source=jaykay;Initial Catalog=SpriteHangFire;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False");
         
     });
 }
开发者ID:karabinier,项目名称:api.lacage.be,代码行数:10,代码来源:Startup.cs

示例8: Configuration

 public void Configuration(IAppBuilder app)
 {
     app.UseHangfire(config =>
     {
         config.UseSqlServerStorage("ScheduleDB");
         config.UseServer();
         config.UseAuthorizationFilters(new[] { new MyRestrictiveAuthorizationFilter() });
         config.UseDashboardPath("/hangfire");
     });
 }
开发者ID:ksmsection9,项目名称:KeldyshPreprintSystem,代码行数:10,代码来源:Startup.cs

示例9: Configuration

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

            app.UseHangfire(config =>
            {
                config.UseAuthorizationFilters();
                config.UseSqlServerStorage("HighlighterDb");
                config.UseServer();
            });
        }
开发者ID:atonse,项目名称:Hangfire,代码行数:11,代码来源:Startup.cs

示例10: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.UseErrorPage();
            app.UseWelcomePage("/");

            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
            app.UseHangfire(config =>
            {
                config.UseSqlServerStorage("DefaultConnection");
                config.UseServer();
            });
        }
开发者ID:taylormaloney,项目名称:signalr-hangfire,代码行数:12,代码来源:Startup.cs

示例11: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.UseHangfire(config =>
            {
                config.UseAuthorizationFilters();

                config
                    .UseSqlServerStorage(@"Server=.\sqlexpress;Database=Hangfire.Sample;Trusted_Connection=True;")
                    .UseMsmqQueues(@".\Private$\hangfire{0}", "default", "critical");
            });

            app.MapHangfireDashboard(
                "/hangfire-redis", 
                new IAuthorizationFilter[0],
                new RedisStorage("localhost:6379", 3));
        }
开发者ID:atonse,项目名称:Hangfire,代码行数:16,代码来源:Startup.cs

示例12: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.UseHangfire(config =>
            {
                //use Firebird embedded with MSMQ
                config
                    .UseFirebirdStorage(@"User=SYSDBA;Password=masterkey;Database=S:\Source\Hangfire.Firebird\HANGFIRE_SAMPLE.FDB;Packet Size=8192;DataSource=localhost;Port=3050;Dialect=3;Charset=NONE;ServerType=1;ClientLibrary=S:\Source\Hangfire.Firebird\Firebird\fbembed.dll;")
                    .UseMsmqQueues(@".\private$\hangfire-{0}");
                config.UseServer();
            });

            app.UseNancy();

            RecurringJob.AddOrUpdate(
                () => TextBuffer.WriteLine("Recurring Job completed successfully!"),
                Cron.Minutely);
        }
开发者ID:yonglehou,项目名称:Hangfire.Firebird,代码行数:17,代码来源:Startup.cs

示例13: Configuration

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

            app.UseHangfire(config =>
            {
                config.UseAuthorizationFilters(new AuthorizationFilter
                {
                    Roles = "Admin"
                });

                config.UseActivator(new Extensions.UnityJobActivator(BusinessLogic.UnityConfig.Container));

                config.UseSqlServerStorage(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

                config.UseServer();
            });

            AS.ChatMessage.Base.IDelete _deleteChatMessages = BusinessLogic.UnityConfig.Container.Resolve<AS.ChatMessage.Base.IDelete>();

            RecurringJob.AddOrUpdate("DeleteChatMessages", () => _deleteChatMessages.Execute(), Cron.Weekly());
        }
开发者ID:kwmcrell,项目名称:ArmedCards,代码行数:22,代码来源:Startup.cs

示例14: Configuration

        public void Configuration(IAppBuilder app)
        {

            app.UseHangfire(config =>
            {
                config.UseSqlServerStorage(CommonHelper.GetJobConnectionString);

                var options = new BackgroundJobServerOptions
                {
                    ServerName = String.Format(
                        "{0}.{1}.{2}",
                        Environment.MachineName,
                        Guid.NewGuid().ToString(),CommonHelper.GetApplicationName)
                };

              

                config.UseServer(options);

            });
         
        }
开发者ID:surifoll,项目名称:git-test,代码行数:22,代码来源:Startup.cs

示例15: Configure

        public static void Configure(IAppBuilder app, IUnityContainer container, string databaseConnectionStringName, AuthenticationOptions authenticationOptions)
        {
            app.CreatePerOwinContext(() => container.Resolve<SecurityDbContext>());
            app.CreatePerOwinContext(() => container.Resolve<ApplicationUserManager>());

            if (authenticationOptions.CookiesEnabled)
            {
                // Enable the application to use a cookie to store information for the signed in user
                // and to use a cookie to temporarily store information about a user logging in with a third party login provider
                // Configure the sign in cookie
                app.UseCookieAuthentication(new CookieAuthenticationOptions
                {
                    AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                    //LoginPath = new PathString("/Account/Logon"),
                    Provider = new CookieAuthenticationProvider
                    {
                        // Enables the application to validate the security stamp when the user logs in.
                        // This is a security feature which is used when you change a password or add an external login to your account.  
                        OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                            validateInterval: authenticationOptions.CookiesValidateInterval,
                            regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                    }
                });
            }

            if (authenticationOptions.BearerTokensEnabled)
            {
                app.UseOAuthBearerTokens(new OAuthAuthorizationServerOptions
                {
                    TokenEndpointPath = new PathString("/Token"),
                    AuthorizeEndpointPath = new PathString("/Account/Authorize"),
                    Provider = new ApplicationOAuthProvider(PublicClientId),
                    AccessTokenExpireTimeSpan = authenticationOptions.BearerTokensExpireTimeSpan,
                    AllowInsecureHttp = true
                });
            }

            if (authenticationOptions.HmacEnabled || authenticationOptions.ApiKeysEnabled)
            {
                var apiAccountProvider = container.Resolve<IApiAccountProvider>();
                var claimsIdentityProvider = container.Resolve<IClaimsIdentityProvider>();
                var cacheManager = container.Resolve<CacheManager>();

                var cacheSettings = new[]
                {
                    new CacheSettings(HmacAuthenticationHandler.CacheGroup, TimeSpan.FromSeconds(60))
                };
                cacheManager.AddCacheSettings(cacheSettings);

                if (authenticationOptions.HmacEnabled)
                {
                    app.UseHmacAuthentication(new HmacAuthenticationOptions
                    {
                        ApiCredentialsProvider = apiAccountProvider,
                        IdentityProvider = claimsIdentityProvider,
                        CacheManager = cacheManager,
                        SignatureValidityPeriod = authenticationOptions.HmacSignatureValidityPeriod
                    });
                }

                if (authenticationOptions.ApiKeysEnabled)
                {
                    app.UseApiKeysAuthentication(new ApiKeysAuthenticationOptions
                    {
                        ApiCredentialsProvider = apiAccountProvider,
                        IdentityProvider = claimsIdentityProvider,
                        CacheManager = cacheManager,
                        HttpHeaderName = authenticationOptions.ApiKeysHttpHeaderName,
                        QueryStringParameterName = authenticationOptions.ApiKeysQueryStringParameterName
                    });
                }
            }

            var permissionService = container.Resolve<IPermissionService>();
            app.UseHangfire(config =>
            {
                config.UseUnityActivator(container);
                config.UseSqlServerStorage(databaseConnectionStringName, new SqlServerStorageOptions { PrepareSchemaIfNecessary = false, QueuePollInterval = TimeSpan.FromSeconds(60) /* 15 Default value */ });
                config.UseAuthorizationFilters(new PermissionBasedAuthorizationFilter(permissionService) { Permission = PredefinedPermissions.BackgroundJobsManage });
                config.UseServer();
            });
        }
开发者ID:Zeeshan-Ahsan,项目名称:vc-community,代码行数:82,代码来源:OwinConfig.cs


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