Enqueued jobs won't start processing

Hi, I just setup MSMQ using a private queue (private$\hangfire-default).
At first I had some access problems but when adding the ApplicationPoolIdentity (IIS APPPOOL\{application pool name}) with full access that was solved.
But now when enqueuing a job it does not start processing.
See here: http://screencast.com/t/jFM2Ii5lrXh0

I don’t see any messages appearing in the message queue.
I’m using version 1.4.3 of Hangfire.
I see the Jobs with state enqueued in the SQL database.
The JobQueue SQL table is empty.

Any idea what’s going on?

Thank you,
Marc

Can you provide code snippets for how you are setting up the hangfire server?

This is the setup:

var options = new SqlServerStorageOptions
{
	InvisibilityTimeout = TimeSpan.FromMinutes(60)
};

Hangfire.GlobalConfiguration.Configuration
	.UseSqlServerStorage("EasyAdsContext", options)
	.UseMsmqQueues(@"v01\private$\hangfire-{0}");

app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
	AuthorizationFilters = new[] { new NoAuthorizationFilter() },
	AppPath = "https://xxxx.xxxx.xx"
});

And here is my NoAuthorizationFilter class:

public class NoAuthorizationFilter : IAuthorizationFilter
{
	public bool Authorize(IDictionary<string, object> owinEnvironment)
	{
		return true;
	}
}

I’m using this because I have IP based authorization configured in IIS on the /hangfire URL.

I’m not seeing where you actually start the hangfire server anywhere there, do you have anything like the following?
var serverOptions = new BackgroundJobServerOptions
{
Queues = new[] { hangfireQueueName },
WorkerCount = hangfireWorkers
};
app.UseHangfireServer(serverOptions);

I’m using this code in my Global.asax:

protected void Application_Start(object sender, EventArgs e)
{
	GlobalConfiguration.Configure(WebApiConfig.Register);
	HangfireBootstrapper.Instance.Start();
}

protected void Application_End(object sender, EventArgs e)
{
	HangfireBootstrapper.Instance.Stop();
}

I see in the HangfireBootstrapper that the Hangfire.GlobalConfiguration.Configuration is set again. But then without the UseMsmqQueues method. That’s probably the problem.
I think I mixed up the code from the ‘Quick start’ and the ‘Making ASP.NET application always running’ pages.

I’ll run some tests. Thanks.

Well, I’ve tested it but it still does not work.
As you can see in my earlier screenshot, there seem to be jobs enqueued but the queue shows length 0.
So somehow the jobs are enqueued but not put in the default queue or something.
The only way I can get rid of them is removing them from the database.
For now I’m just using SQL and have increased the InvisibilityTimeout.
But since I need a high performance queuing system I’d prefer the MSMQ system.

What might have something to do with it is that I could nog get the ‘Enabling Service Auto-start’ part to work.
For now I have just set the recycling and idletime to 0 which seems to work as well.

I believe you have to specify the queue names when you call UseMsmqQueues, see: https://github.com/HangfireIO/Hangfire/blob/5a770aab402b820f262f0872b18c2d3304bb7128/samples/MvcSample/Startup.cs

That still does not work. I’ve tried various ways and combinations but the queue always show length 0.

Can you try adding logging, I used nlog when I was having problems to display all the info messages hangfire outputs as it runs, there is probably an exception on the worker process, it’ll be useful to know what the exception is.

So I know this is old but I just had the same issue. I did not set up MSMQ as a transactional queue. After changing it to transactional it fixed my problem which was identical to what is explained here. Hope this helps

@DamianC I have the same problem, Can you explain more about how to set MSMQ as transactional queue and what it actually means… It would be helpful thanks

To make a transactional queue, delete the old queues and create new ones. When creating a new queue, click the “transactional” checkbox. Sorry for the bump