# JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API

**URL:** <https://discuss.hangfire.io/t/jobstorage-current-property-value-has-not-been-initialized-you-must-set-it-before-using-hangfire-client-or-server-api/6958>\
**Category:** question\
**Tags:** sql-server, aspnetcore\
**Created:** [January 9, 2020, 2:16am UTC](https://discuss.hangfire.io/t/jobstorage-current-property-value-has-not-been-initialized-you-must-set-it-before-using-hangfire-client-or-server-api/6958 "2020-01-09T02:16:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgrandydev](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jgrandydev](https://discuss.hangfire.io/u/jgrandydev)\
**Post date:** [January 9, 2020, 2:16am UTC](https://discuss.hangfire.io/t/jobstorage-current-property-value-has-not-been-initialized-you-must-set-it-before-using-hangfire-client-or-server-api/6958/1 "2020-01-09T02:16:57Z")

</div>

```
public void ConfigureServices(IServiceCollection services)
{
    // Add Hangfire services.
    services.AddHangfire(configuration => configuration
      .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
      .UseSimpleAssemblyNameTypeSerializer()
      .UseRecommendedSerializerSettings()
      .UseSqlServerStorage({my-connection-string},
                           new SqlServerStorageOptions
                           {
                             PrepareSchemaIfNecessary = true,
                             CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
                             SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
                             QueuePollInterval = TimeSpan.Zero,
                             UseRecommendedIsolationLevel = true,
                             UsePageLocksOnDequeue = true,
                             DisableGlobalLocks = true
                           }));
    services.AddHangfireServer();
}

```

However when I invoke a Hangfire task :

```
BackgroundJob.Schedule(
    () => CheckUpload({my-data}),
    TimeSpan.FromSeconds({my-interval}));

```

I receive this error :

```
JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.

```

But I would think this was taken care of by my `UseSqlServerStorageOptions` init.

---

<div class="post-metadata">

**Author:** ![alexandis](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/alexandis/32/2354_2.png) [@alexandis](https://discuss.hangfire.io/u/alexandis)\
**Post date:** [December 14, 2020, 7:16pm UTC](https://discuss.hangfire.io/t/jobstorage-current-property-value-has-not-been-initialized-you-must-set-it-before-using-hangfire-client-or-server-api/6958/2 "2020-12-14T19:16:47Z")

</div>

Had the same issue. It appeared that the supplied connection string was incorrect and I did not have global connection string initialization. In fact, everything you need in the consumer - is installed “Hangfire” package + setting proper connection string:

```
private void ConfigureHangfire(IConfiguration configuration)
{
    GlobalConfiguration.Configuration.UseSqlServerStorage(configuration.GetConnectionString("Hangfire"));
}
```

---

<div class="post-metadata">

**Author:** ![rodwin](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/rodwin/32/2971_2.png) [@rodwin](https://discuss.hangfire.io/u/rodwin)\
**Post date:** [July 21, 2022, 9:04pm UTC](https://discuss.hangfire.io/t/jobstorage-current-property-value-has-not-been-initialized-you-must-set-it-before-using-hangfire-client-or-server-api/6958/3 "2022-07-21T21:04:30Z")

</div>

In my case where I user [asp.net](http://asp.net) mvc5, I needed to restart the application pool in IIS.

---

<div class="post-metadata">

**Author:** ![alexandis](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/alexandis/32/2354_2.png) [@alexandis](https://discuss.hangfire.io/u/alexandis)\
**Post date:** [November 2, 2022, 7:45pm UTC](https://discuss.hangfire.io/t/jobstorage-current-property-value-has-not-been-initialized-you-must-set-it-before-using-hangfire-client-or-server-api/6958/4 "2022-11-02T19:45:32Z")

</div>

Strange… In another project I have this error and nothing helps so far… I’ve also noticed, that `Action` from `AddHangfire` is not called prior to calling my appService method…
