本文整理汇总了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;
}
示例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!"));
}
示例3: Configuration
public void Configuration(IAppBuilder app)
{
app.UseHangfire(config =>
{
config.UseSqlServerStorage(ConfigurationManager.ConnectionStrings["ApiDataContext"].ConnectionString);
config.UseServer();
});
}
示例4: Configuration
public void Configuration(IAppBuilder app)
{
app.UseHangfire(config =>
{
config.UseSqlServerStorage("JobHangFireIoDb");
config.UseServer();
});
}
示例5: Configuration
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
app.UseHangfire(config =>
{
config.UseSqlServerStorage("DataContext").UseMsmqQueues(@".\private$\hangfire-0");
});
}
示例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
});
}
示例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");
});
}
示例8: Configuration
public void Configuration(IAppBuilder app)
{
app.UseHangfire(config =>
{
config.UseSqlServerStorage("ScheduleDB");
config.UseServer();
config.UseAuthorizationFilters(new[] { new MyRestrictiveAuthorizationFilter() });
config.UseDashboardPath("/hangfire");
});
}
示例9: Configuration
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
app.UseHangfire(config =>
{
config.UseAuthorizationFilters();
config.UseSqlServerStorage("HighlighterDb");
config.UseServer();
});
}
示例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();
});
}
示例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));
}
示例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);
}
示例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());
}
示例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);
});
}
示例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();
});
}