# Using IProcessHostPreloadClient with IoC Container to ensure HangFire and ASP.NET app always running

**URL:** <https://discuss.hangfire.io/t/using-iprocesshostpreloadclient-with-ioc-container-to-ensure-hangfire-and-asp-net-app-always-running/928>\
**Category:** question\
**Created:** [May 4, 2015, 8:11pm UTC](https://discuss.hangfire.io/t/using-iprocesshostpreloadclient-with-ioc-container-to-ensure-hangfire-and-asp-net-app-always-running/928 "2015-05-04T20:11:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tafs7](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/tafs7/32/260_2.png) [@tafs7](https://discuss.hangfire.io/u/tafs7)\
**Post date:** [May 4, 2015, 8:11pm UTC](https://discuss.hangfire.io/t/using-iprocesshostpreloadclient-with-ioc-container-to-ensure-hangfire-and-asp-net-app-always-running/928/1 "2015-05-04T20:11:49Z")

</div>

I followed the advice on docs page below:  
[http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html#comment-2002936003](http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html#comment-2002936003)  
(linked to my related comment)

While this will work for setting up the Application\_Start and Application\_Stop (in global.asax) because I have access to the Container from there, as that is my composition root…

How can i use IoC containers with this interface if my container won’t exist by the time the Preload() fires? My HangFire configuration requires a custom activator and a context scope filter, both of which depend on access the Container:

```
GlobalConfiguration.Configuration.UseActivator(new SimpleInjectorJobActivator(container));
GlobalJobFilters.Filters.Add(new SimpleInjectorExecutionContextScopeEndFilter(container));
```

---

<div class="post-metadata">

**Author:** ![mohan\_naik](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/mohan_naik/32/3290_2.png) [@mohan\_naik](https://discuss.hangfire.io/u/mohan_naik)\
**Post date:** [August 30, 2023, 8:56am UTC](https://discuss.hangfire.io/t/using-iprocesshostpreloadclient-with-ioc-container-to-ensure-hangfire-and-asp-net-app-always-running/928/2 "2023-08-30T08:56:09Z")

</div>

I have same question, did you get answer or solution for it?
