Hangfire Dashboard showing jobs have ran successfully but actually nothing has happened

I have following line of code for queueing up an emailing task that is supposed to send out an email when executed successfully. When I run the original method of SendEmail then the email is sent out successfully so that means original method has no issues, but with Hangfire Enqueue method no email gets sent even though on dashboard the scheduled job shows up to have run successfully.

Question: Why is Hangfire behaving in above manner? I think I may be missing some configuration, even though I have set up the startup class according to documentation. Or is it the VB.Net syntax that is not correct?

Hangfire.BackgroundJob.Enqueue(Sub() ABC.Utilities.Helper.SendEmail(prod.ProductEmailAddresses, cp.UserEmail, String.Format(subject, prod.ProductName), String.Format(body, prod.ProductName, cp.UserFullName), EmailMessageFormats.Html, String.Empty))

I just found out that the reason no emails were going out was because the enqueue method was never being hit. As soon as I forced that code to execute then hangfire enqueue method sent out an email according to expectations.

It was an error on my part to say that nothing was happening. Actually another app localhost/webjobs with a recurring job was filling up its database with jobs data since it was also running on my laptop. I mixed up this app with the app localhost/app1 which I was looking at when I created this support ticket.

So the VB.Net code for calling enqueue is fine and has no problems.
Hangfire is a super-powerful infrastructure for any ASP.Net web app as I am discovering, and its super-easy to set up.

1 Like