# Hangfire + SimpleInjector + MVC app

**URL:** <https://discuss.hangfire.io/t/hangfire-simpleinjector-mvc-app/5550>\
**Category:** question\
**Created:** [November 7, 2018, 3:04pm UTC](https://discuss.hangfire.io/t/hangfire-simpleinjector-mvc-app/5550 "2018-11-07T15:04:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.skomra](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/t.skomra/32/1436_2.png) [@t.skomra](https://discuss.hangfire.io/u/t.skomra)\
**Post date:** [November 7, 2018, 3:04pm UTC](https://discuss.hangfire.io/t/hangfire-simpleinjector-mvc-app/5550/1 "2018-11-07T15:04:02Z")

</div>

Hi there good people,

I’m trying to setup Hangfire for our MVC app. I followed all tutorials, used Devmondo HangFire.SimpleInjector for activator logic but still have issues.

My startup setup is as following:

//Hangfire  
Hangfire.GlobalConfiguration.Configuration.UseSqlServerStorage(webClientConfigurationService.DataConnectionStringName);  
Hangfire.GlobalConfiguration.Configuration.UseActivator(new SimpleInjectorJobActivator(Core.Dependencies.DependencyResolver.Container));  
app.UseHangfireDashboard();  
app.UseHangfireServer();

```
        //add hangfire test job
        var _selfAccreditationsService = Core.Dependencies.DependencyResolver.Resolve<ISelfAccreditationsService>();
        RecurringJob.AddOrUpdate(() => _selfAccreditationsService.TestHangFire(), Cron.MinuteInterval(1));

```

Application starts fine but when I go to dasboard I can see:

System.TypeLoadException: Could not load type ‘SimpleInjector.Lifestyles.AsyncScopedLifestyle’ from assembly ‘SimpleInjector, Version=3.1.2.0, Culture=neutral, PublicKeyToken=984cb50dea722e99’.  
at Hangfire.SimpleInjector.SimpleInjectorJobActivator.BeginScope(JobActivatorContext context)  
at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context)  
at Hangfire.Server.BackgroundJobPerformer.\<\>c\_\_DisplayClass8\_0.b\_\_0()  
at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation) at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable`1 filters)  
at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context)  
at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)

EDIT:  
Even with fresh MVC template project after adding all of above it’s still giving me same error ☹

Do you guys have any ideas what I have missed?  
Would really appreciate any help with this.

Thanks
