Background processing in ASP.NET
As part of my bicycle climbs website, I need to spend some time calling a web service to fetch the elevation of 250 different points. Each call takes a few seconds.
Ideally, what I would have is a way to start the processing but not have it block my normal page processing operation.
Ideas? I looked at the MSDN docs here, but that requires me to continually refresh the page. I could do that if necessary if there's no other way.
Comments
- Anonymous
November 27, 2005
http://www.asp.net/default.aspx?tabindex=9&tabid=47
http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/
http://www.stardeveloper.com/articles/display.html?article=2001121901&page=1 - Anonymous
November 27, 2005
AJAX?
This sounds like the perfect use for it.
You could even use MS's Atlas framework. - Anonymous
November 28, 2005
I'm not sure I completely understand your problem, but there's no reason you couldn't start a worker thread for this purpose. If it's a one-time event you could stick it in Application_Start. - Anonymous
November 28, 2005
If you want users to be able to view and use a page while the elevation data is being loaded, the best approach is AJAX and if possible MS Atlas Framework. - Anonymous
November 28, 2005
The comment has been removed - Anonymous
November 28, 2005
http://msdn.microsoft.com/msdnmag/issues/05/01/ASPNETPerformance/
I hope this helps you out Eric, this is an older article but Tip Number 6 how to do Background Processing in asp.net I think should fit the bill. - Anonymous
November 28, 2005
The comment has been removed - Anonymous
November 29, 2005
How often do the elevations change? :)
Why don't you parse the data into a format most useful for your application, and hard code it? You probably want to write a tool to converts the real underlying data to your special format, but there is no need for the site to be truly dynamic.
That's the approach I took for my Commute Times survey: http://www.leeholmes.com/projects/commute - Anonymous
November 30, 2005
Lee,
The user draws a path on the map, and I fetch the elevations from the USGS web service based on that path.
I'd looked at getting my own copy of the elevation data. I might be able to do it if I was only concerned about Washington, but at the level of resolution I want, the Puget Sound area by itself is well over a Gig of data, and I'd like to cover the whole US, so it just isn't practical. - Anonymous
December 02, 2005
Aren't you looking for this? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/PAIBlock.asp - Anonymous
December 08, 2005
Eric - I'd be interested to know what approach you finally ended up implementing.