User already has more than 'max_user_connections' active connections HANGFIRE

时光毁灭记忆、已成空白 提交于 2020-01-03 02:21:06

问题


I understand

User already has more than 'max_user_connections' active connections

has already many answers. But this is in regard to Hangfire.

I am using Hangfire for background processing. It worked fine for the first time and only when I started my application. But now its not. SO now when I am trying to open the database to see what's happening it gives me this error.

My idea is that it cannot execute any more items in the queue because it cannot connect to the database.

Also, I cannot open the Hangfire dashboard. It gives 404 error.

I have created the OWIN startup.cs as

using Hangfire;
using Microsoft.Owin;
using Owin;

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

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

Also, I have put the code as required in 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();

Is there any way I can avoid max_user_connection error ? Or actually, run the background call. Here it is how I am calling it: BackgroundJob.Enqueue(() => MyMethod());

UPDATE: After timeout, I saw the database and found that Second operation was not inserted into database, however, the third one was inserted but gives the state of the job as this:
Retry attempt 1 of 10: Exception has been thrown by the target of an inv...

来源:https://stackoverflow.com/questions/49789937/user-already-has-more-than-max-user-connections-active-connections-hangfire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!