在哪里可以找到 "IDashboardAuthorizationFilter" 接口 (Hangfire)

Where to find "IDashboardAuthorizationFilter" interface (Hangfire)

我正在尝试实施 Hangfire 授权,但我发现很少有像 this 这样的解决方案可能对我有用,但我无法实施接口 IDashboardAuthorizationFilter。不确定我必须使用什么命名空间才能使它正常工作,或者我是否缺少任何库。请提出建议。

我的包版本: Hangfire:v 1.6.8 Hangfire.Dashboard.Authorization:v 2.1.0(最新)

我也试过将 Hangfire 更新到最新版本,但没有成功。

P.S:我没有足够的代表发表评论 post。因此,post作为新问题。

谢谢!

更新:

我的代码

using System;
using Owin;
using Hangfire;
using Hangfire.Dashboard;
using System.Collections.Generic;
using Hangfire.SqlServer;
using System.Web;

namespace Example
{
    public class HangFireAuthorizationFilter : **IDashboardAuthorizationFilter** //getting error here
    {
        public bool Authorize(IDictionary<string, object> owinEnvironment)
        {          
            return HttpContext.Current.User.Identity.IsAuthenticated;
        }
    }
}

更新 2: 看起来我的 nuget 包是最新的 Hangfire 但我引用的 Hangfire.Core dll 不是最新的。现在是1.58。当我重新安装 nuget 包时,它仍然保持不变。

删除 Hangfire.Core nuget 包并重新安装它对我有用。另外,我在同一个项目的共享库中有一些旧的 hangfire dll,这就是我安装新版本时导致覆盖 dll 的原因。