问题
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