我在 mvc 应用程序中使用hangfire。我正在向用户发送提醒
预约。我已经在我的应用程序中安装了hangfire。我已经配置了hangfire
启动.cs 类。但是当我运行该应用程序时,它会产生以下错误,
作业存储。当前属性值尚未初始化。您必须在使用 Hangfire 客户端或服务器 API 之前设置它。
using Hangfire;
using Hangfire.SqlServer;
using Microsoft.Owin;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UKC.Data.Infrastructure;
using UKC.UI.Helper;
[assembly: OwinStartup(typeof(UKC.UI.App_Start.Startup))]
namespace UKC.UI.App_Start
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
GlobalConfiguration.Configuration
.UseSqlServerStorage("DbEntities");
app.UseHangfireDashboard();
app.UseHangfireServer();
}
}
}
用于在Asp.net core中初始化
public static void InitializeHangFire()
{
var sqlStorage = new SqlServerStorage("connectionString");
var options = new BackgroundJobServerOptions
{
ServerName = "Test Server"
};
JobStorage.Current = sqlStorage;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)