Executing Asynchronous Tasks in ASP.NET
page 1 of 6
Published: 05 Dec 2008
Abstract
In this article, Andrea examines the different ways to execute asynchronous tasks in ASP.NET leveraging the built-in Page's methods and Asynchronous Delegates. He begins with a short introduction and then delves deep into the steps involved with the starting of asynchronous tasks using PageAsyncTask and asynchronous delegates with the help of relevant source code, screen shots, a sample project, and links to useful articles.
by Andrea Colaci
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 38304/ 45

Introduction

In this article I want to show three different ways to deal with long running tasks in ASP.NET.
If such a task must be initiated from an ASP.NET web page, the thread that is serving the page request is bound to the task until it completes or a timeout occurs. ASP.NET and .NET Framework offer different ways to address this issue. In the project used for this article, a sample page attempts to star a long running task in three different ways.

1. Synchronously simply starting the task and waiting for its completion
2. Asynchronously, using PageAsyncTask and other features
3. Asynchronously, using Asynchronous Delegates

Each of these options have pro and cons, and fit in different scenarios, but also these options do not require including the Async="true" attribute in the page's @Page directive.

The first option entails to keep busy the thread that is serving the request until the task completes. This could be a bottleneck, especially if multiple users start multiple tasks. This condition will probably end up to a 503 "Server Unavailable" error.

In this article I have used a sample web page that can start the same long-running task in three different ways.

Figure 1 - Sample page used in tests


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-19 3:05:03 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search