Managing long-term server processes with ASP.NET Web-services

It᾿s well known that the server response on browser requests is limited by a timeout, which is usually set to 30 seconds. There are situations when server processes (like transferring large data to a database) require much more time. Such processes cause the browser to halt and even lead to timeout exceptions.

To avoid these problems, an approach of ASP.NET web-services can be applied while developing a web-application. This approach allows requesting a web-service to run a server process and then the browser periodically asks the web-service if the job done (see schema bellow).

An1_1

The web service is launched in asynchronous mode and stores data about each user who requested to run the long-term process. Thus, many users can simultaneously request the web-service to run their own jobs (see schema bellow).

An2_1

While running the job, the client can ask the service about the process status and update the web-page using an Ajax method or full page reload.

Let᾿s take a look at a sample of a long-term process using ASP.NET web-services in Newsberry, our online email marketing service. Newsberry can import a customer᾿s subscriber list into the system via a text or excel file. With web-services the import process on large email lists (60,000+ subscribers) can now run for minutes, opposed to over an hour. In this case, the customer needs to know the status of the import. The new import tool updates the customers about the import process using the Ajax method (see screenshot bellow).

An3_2

As you can see, web-services make it much easier to run long processes through the web with smooth progress indicators in the user interface. The use of web-services allows designers to create tools that were once complicated to implement and use. With the new popularity of Ajax combined with web-services you can expect many more innovative uses to surface.

Comments

Our products