Using hangfire BackgroundJob.Schedule with httpclientfactory DI


#1

Sorry in advance if this is not the preferred way to post a question, but I created a post on stack overflow and figured it would be good to ask here as well. perhaps a link to the post is enough, otherwise please remove this and I’ll post the whole thing. I’ve tried to read all question and documentation, but I just do not understand what i’m doing wrong or should be doing so any pointer would be very much appreciated.


#3

Someone directed me to the correct solution… however I can’t find who did it so I can’t credit him/her.

The solution was to use the Interface when triggering the method: <IBackupApiService>

var resp = BackgroundJob.Schedule<IBackupApiService>(service => _backupApiService.AdhocBackup(serverSchedule.Servername), serverSchedule.Date);