【发布时间】:2015-01-08 10:13:03
【问题描述】:
我使用 Visual Studio 2013 从 File > new > Website (not project) 创建了空的 asp.net webforms 网站并安装了 Hangfire 库。然后我在 App_code 和根文件夹中添加了 Startup.cs 文件。然后我在 Global.ascx 文件中创建了简单的测试
void Application_Start(object sender, EventArgs e)
{
Hangfire.RecurringJob.AddOrUpdate(() => Console.WriteLine("I am done!"), Hangfire.Cron.Minutely);
}
当我尝试运行网站时,它返回
JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.
但是如果我创建一个项目并执行相同的步骤,它运行没有任何问题,任何人都可以提供帮助吗?
【问题讨论】:
-
看起来有一些诡计frankouimette.com/…
-
@rogerdeuce 谢谢,但我解决了问题
-
能否发布您的解决方案?它如何初始化Hangfire?以及它在哪里初始化(在 Global.asax 中)?