How to use DI container in WIndows Service?

Has anyone used a DI container when running the Hangfire Job engine in a windows service?
Is this possible?

Yes, you can use DI container in Hangfire Job engine in windows service. i am using it via Microsoft.UnityContainer and ServiceLocator.

public static IUnityContainer ConfigureUnityContainer() {

        IUnityContainer _unityContainer = new UnityContainer();
        var section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); //QueueContainer
        var locator = new UnityServiceLocator(_unityContainer);
        ServiceLocator.SetLocatorProvider(() => locator);
        return _unityContainer;

public interface IJobInitiatorManager
void Start();

protected override void OnStart(string[] args)
IUnityContainer container = UnityHelper.ConfigureUnityContainer();
IJobInitiatorManager manager = container.Resolve();
//Start Job
RecurringJob.AddOrUpdate(fx => fx.Start(), Cron.Daily);

*Inside Concret implementation of IJobInitiatorManager you can use DI
Hope this will help :smile: