'.NET Core background job with HttpContext

I need a .Net core, user-triggered background job approach, which supports the HttpContext of that user. I've gone down the hangfire path unsuccessfully, and what I can tell, BackgroundService does not support this. Spawning a thread does, but that seems like a no-no. Any input on a good design for this?

Hangfire throws null exceptions when accessing it, after queueing and firing the job. That also seems to be the case with BackgroundService and Thread spawning. Basically any background process seems to disconnect from HttpContext, presumably due to the separately-threaded nature.

Is the only option to pass all necessary HttpContext info into the job?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source