Thursday, October 27, 2005
Problems with Async Fire-and-Forget from ASP.NET
The one solution that may solve this, that I haven't tried, is to use a custom thread pool using reflection to call private .NET framework methods. Mike Woodring has an example of this.
Other solutions involve:
Invoke style asynch function/WebService calls with an empty End handler:
This holds on to the page/thread depleting the ASP.NET Thread pool
Calling ThreadPool.QueueUserWorkItem in a synch Web Service
This also steals threads and uses the IsBackground property set to true. "When you do this, you're saying, "It's okay if the process shuts down while this thread is still running."
using the OneWay=true attribute of WebServices:
There is a bug that drops the thread context allowing things like integrated security (no sql or file handling)
Currently I'm just calling a sync WebService that starts its own thread and immediately returns, buffering the database connection and filestreams in the thread class before starting the thread. This also leaving me to manage my own threads.
This seems way to hard, for something that should be extremely simple.