用户已拥有超过“max_user_connections”个活动连接 HANGFIRE

2024-04-30

我明白

用户已拥有超过“max_user_connections”个活动连接

已经有很多答案了。但这是关于Hangfire的。

我在用Hangfire http://docs.hangfire.io/en/latest/background-processing/processing-jobs-in-web-app.html#using-backgroundjobserver-class用于后台处理。 它第一次运行得很好,并且只有当我开始我的应用程序时才运行良好。但现在不是了。所以现在当我尝试打开数据库以查看发生了什么时,它给了我这个错误。

我的想法是它无法执行队列中的更多项目,因为它无法连接到数据库。

另外,我无法打开 Hangfire 仪表板。它给出 404 错误。

我已将 OWINstartup.cs 创建为

using Hangfire;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(MyApp.Startup))]

namespace MyApp
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseHangfireDashboard();
        }
    }
}

另外,我已将所需的代码放入Application_Start in Global.asax.cs as:

var options = new Hangfire.MySql.MySqlStorageOptions
{
    QueuePollInterval = TimeSpan.FromSeconds(15), // Default value
    PrepareSchemaIfNecessary = false
};
Hangfire.MySql.MySqlStorage storage = new Hangfire.MySql.MySqlStorage("hangfire2", options);
GlobalConfiguration.Configuration.UseStorage(storage);
_backgroundJobServer = new BackgroundJobServer();

有什么办法可以避免max_user_connection错误 ?或者实际上,运行后台调用。 这就是我的称呼:BackgroundJob.Enqueue(() => MyMethod());

UPDATE:超时后,我查看数据库,发现第二个操作没有插入数据库,但是,第三个操作已插入,但给出的作业状态如下:
Retry attempt 1 of 10: Exception has been thrown by the target of an inv...


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

用户已拥有超过“max_user_connections”个活动连接 HANGFIRE 的相关文章

随机推荐