I invoke a lot of asynchronous activities from my ASP.NET app. For example, when app starts, I put a file-system watcher on a folder and perform some actions when the watcher fires its events.
Also, I subscribe to Sql Server Query Notifications (manually, not using SqlDependency) and again actions are performed when notifications are fired.
I wonder which threads these asynchronus notifications are fired upon? Are they fired on an ASP.NET thread-pool thread, or another background thread?
Also, the notifications for Watcher and for QN would be fired on the same thread, or they would always be on different threads?
In these background threads, I create a custom HttpContext that is used by the code. Although I think this would be true, but I wanted to confirm that assigning HttpContext.Current is on a per-thread basis. So, assuming QN and watcher events are fired on different threads, and I assign a HttpContext to in both the events, is it guaranteed that the 2 HttpContexts would be different and the same code executing for the 2 events and accessing HttpContext would be accessing 2 different contexts??
View Complete Post