HangfireIO / HangfireIO/Hangfire
Configure HangFire to be able to create the job in a web app (.net4.5) and process it in a windows service.
- Dominant language
- C#
- Stars
- 10.1k
- Forks
- 1.8k
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 1
Description
I've found this comment: https://github.com/HangfireIO/Hangfire/issues/1111#issuecomment-370233049 and it says to make sure to not start the hangfire server in the web app. Just wondering how to do it. I've wired up hangfire using OWIN and following the Hangfire.Highlighter project which does the following:
```
public class Startup
{
public static IEnumerable GetHangfireConfiguration()
{
GlobalConfiguration.Configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseLog4NetLogProvider()
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage("HangFire", new SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero,
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
UseRecommendedIsolationLevel = true,
DisableGlobalLocks = true,
EnableHeavyMigrations = true
});
yield return new BackgroundJobServer(new BackgroundJobServerOptions
{
WorkerCount = 4,
StopTimeout = TimeSpan.FromSeconds(5)
});
}
public void Configuration(IAppBuilder app)
{
app.UseHangfireAspNet(GetHangfireConfiguration);
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new IDashboardAuthorizationFilter[0]
});
}
```
Just wondering how to get hangfire connecting to sql server on the web app, adding jobs to the queue but not processing them so that they can be processed by this separate windows service.
Contributor guide
Assessment
This issue has not been assessed yet.