.Net Core Hosted Service Requires HttpContext
.Net Core Hosted Service Requires HttpContext EDIT Summary I have a background service, which requires a DBContext, my DbContext is dependent on the HttPContext, because it uses the UserClaims to filter the context. The HttpContext which is null when requesting the DbContext from BackgroundService, (this is by design because there is no WebRequest associated with a BackgroundService). How can I capture and moq the HTTPContext, so my user claims will carry over to the background service? I'm writing a hosted service to queue pushing messages from my Hubs in Signalr. My Background. public interface IBackgroundTaskQueue { void QueueBackgroundWorkItem(Func<IServiceProvider, CancellationToken, Task> workItem); Task<Func<IServiceProvider, CancellationToken, Task>> DequeueAsync(CancellationToken cancellationToken); } public class BackgroundTaskQueue : IBackgroundTaskQueue { private ConcurrentQueue<Func<IServiceProvider, CancellationToken, Task>>...