Skip to content

Instantly share code, notes, and snippets.

@dilhan2013
Last active February 18, 2017 04:11
Show Gist options
  • Save dilhan2013/4beb69c406b37b8095c66ee901828a1e to your computer and use it in GitHub Desktop.
Save dilhan2013/4beb69c406b37b8095c66ee901828a1e to your computer and use it in GitHub Desktop.
HangFire SimpleInjector Integration - ASP.NET Web Application
Step 1:
Install HangFire.SimpleInjector NuGet from
https://www.nuget.org/packages/Hangfire.SimpleInjector/
Step 2:
Add following code block in Global.asax.cs file,
protected void Application_Start(object sender, EventArgs e)
{
var container = new Container();
container.Register<ILogger, AppLogger>(Lifestyle.Singleton);
GlobalConfiguration.Configuration.UseActivator(new SimpleInjectorJobActivator(container));
HangfireBootstrapper.Instance.Start();
}
Reference:
http://docs.hangfire.io/en/latest/background-methods/using-ioc-containers.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment