簡體   English   中英

Hangfire ASP.NET核心包

[英]Hangfire ASP.NET Core packages

我已經安裝了包:

Hangfire.AspNetCore Hangfire.MemoryStorage.Core

這是我的代碼:

using Hangfire;
using Hangfire.MemoryStorage;

public void ConfigureServices(IServiceCollection services)
{
    services.AddHangfire(c => c.UseStorage(GlobalConfiguration.Configuration.UseMemoryStorage()));
    services.AddMvc();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    app.UseHangfireServer(); 
}

...

public static void Main(string[] args)
{
    RecurringJob.AddOrUpdate(() => Console.Write("Easy!"), Cron.Minutely);
}

但是,我收到錯誤:

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

我的應用程序在ASP.NET Core上運行。

Main方法在ConfigureConfigureServices之前運行,因此您在配置發生之前嘗試使用Hangfire

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM