My application load asynchronously a big amount of information from a web service and "Application_Start".
If an user request wants to use that information, and it is nor ready, the thread will be block with a Monitor.Wait. When the information is ready, the cache object will Monitor.Pulse all waiting threads. This should be fine, since the information takes a dozen of seconds, and the user has to be redirected to the login page, post login information, and be redirected again.
The problem, is that Monitor.Wait will block the CLR ThreadPool thread, and as far as I know if a burst of requests arrives asking for the "big information", the application could remain block by CLR ThreadPool starvation (I have a little mess with the current IIS/ASP.NET thread gating).
Since the big piece of information comes from a web service that I call asynchronously, I have the IAsyncResult of that operation.
So, Is there a way to tell a CLR ThreadPool Thread "Wait for this IOCP", so the threadpool thread can start to attend other call?
I have the feeling that this is not well explained, let me know if it is not clear what I am asking.
Regards.
PS: Although the bounty is over, if anybody knows a way to do that I will raise a new one and grant the author.
This is a great question. My experience has been to more you try to interfere with ASP.NET internals the more pain you cause.
Have you considered using serviceAutoStartProviders
to keep your app hot?