<$BlogRSDUrl$>

Thursday, October 27, 2005

Problems with Async Fire-and-Forget from ASP.NET 

I have been having an extended discussion about how to do Fire-and-forget asynch webservice calls from an ASP.NET page, on Dino Esposito's WebLog. I have also had a number of discussion with Microsoft and others about this issue with no simple solution. Many suggestions have been made, but they all have problems.

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.

Topics: Async | Threads


Comments: Post a Comment

This page is powered by Blogger. Isn't yours?