Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 5 发布项目后,Hangfire不再工作_Asp.net Mvc 5_Hangfire - Fatal编程技术网

Asp.net mvc 5 发布项目后,Hangfire不再工作

Asp.net mvc 5 发布项目后,Hangfire不再工作,asp.net-mvc-5,hangfire,Asp.net Mvc 5,Hangfire,我正在使用ASP.NETMVC5。NET Framework的版本为4.5。 在我发布了我的项目后,Hangfire不再工作了。所以我重复的任务不起作用。当我进入www.{myurl}/Hangfire时,我得到一个空白站点。 conenction字符串不会引发错误 config.UseSqlServerStorage("Server={myServer}.database.windows.net,1433;Database={myDatabase};User ID={myUserId};Pas

我正在使用ASP.NETMVC5。NET Framework的版本为4.5。 在我发布了我的项目后,Hangfire不再工作了。所以我重复的任务不起作用。当我进入www.{myurl}/Hangfire时,我得到一个空白站点。 conenction字符串不会引发错误

config.UseSqlServerStorage("Server={myServer}.database.windows.net,1433;Database={myDatabase};User ID={myUserId};Password={MyPassword};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
config.UseServer(); 
那么问题出在哪里呢?当我在localhost上运行我的项目时,它工作得很好。
我在本地主机和我发布的项目版本上使用相同的数据库。

默认情况下,对Hangfire Dashboard的远程请求被拒绝–在将授权发布到生产环境之前,很容易忘记授权

您可以使用包根据用户、角色、声明或基本身份验证配置授权;或者创建您自己的授权筛选器,如下所示

using Hangfire.Dashboard;

public class MyRestrictiveAuthorizationFilter : IAuthorizationFilter
{
    public bool Authorize(IDictionary<string, object> owinEnvironment)
    {
        // In case you need an OWIN context, use the next line.
        // `OwinContext` class is defined in the `Microsoft.Owin` package.
        var context = new OwinContext(owinEnvironment);

        return false; // or `true` to allow access
    }
}

这不是一个好的实践,但是您可以使用以下代码来允许所有用户

app.UseHangfire(config =>
{
    config.UseAuthorizationFilters(); //allow all users to access the dashboard
});
代码

app.UseHangfire(config =>
{
    config.UseAuthorizationFilters(); //allow all users to access the dashboard
});