Why ASP. NET workflow?

Source: Internet
Author: User

Introduction to the origin of ASP. NET workflows

Software developers are often asked to build Web applications that support long-running operations. The online store checkout process is an example. It takes only a few minutes to complete. Although this is a long-running operation according to some standards, I will discuss a long-running operation with different scales IN THIS ARTICLE: it takes several days or weeks, operations that can be completed in months. An example of this operation is the job application process, which involves interaction between multiple people and exchange of many practical documents.

First, we will consider a more benign problem from the ASP. NET perspective: You need to build a solution for the online store checkout operation. Due to its special duration, we need to take special considerations for this solution. For example, you may choose to store the shopping cart data in an ASP. NET session. You can even choose to move the session status to an out-of-process server or database to update the site and load balancing. Even so, you will find that all the tools needed to easily solve this problem are provided by ASP. NET itself.

However, if the operation duration becomes longer than the typical ASP. NET session lasts for 20 minutes) longer, or multiple participants are required, as in the employment example just now), ASP. NET cannot provide adequate support. You may remember that the ASP. NET workflow will be automatically closed and recycled on a regular basis when it is idle. This may cause serious errors in long-running operations because the saved status in these processes will be lost.

Imagine that you will need to host these long-running operations within a single process. Obviously, for the above reason, ASP. NET workflow does not apply to them. Therefore, you need to create a window service. Its responsibility is to perform these operations. If you never restart the service, ASP is used directly. NET is more likely to get a solution, because theoretically, a service process that cannot be automatically restarted ensures that the status of long running operations will not be lost.

But can this really solve this problem? Probably not. What if the server needs load balancing? If the idea is limited to a single process, the situation will become very difficult. What's worse, what if you need to restart the server or crash the process? If this happens, all running operations will be lost.

In fact, when an operation takes several days or weeks to complete, you need a solution that is independent of the lifecycle of the operation process. This is an indisputable fact, especially for ASP. NET Web applications.

Manage ASP. NET workflows

Windows Workflow Foundation (WF) may not be the technology that comes to mind when building Web applications. However, the multiple main functions provided by WF make the workflow solution significant. With WF, you can completely detach idle workflows from the process space and automatically reload them to the active process when the workflow is busy, for process independence for long-running operations, see Figure 1 ). WF can be used to overcome the uncertain impact of ASP. NET workflow on the lifecycle, and to prepare for long running operations in Web applications.

Figure 1 cross-process instance workflow retention

WF combines two main features to implement this function. First, asynchronous activities send idle signals to the workflow when waiting for external events. Next, the persistent service detaches idle workflows from the process, saves them to a persistent storage location such as a database, and reloads the workflow when preparing for re-running.

Such process independence also has other advantages. It provides a simple load balancing method and durability-fault tolerance in the event of a process or Server failure.

The above is a brief introduction to ASP. NET workflow requirements and their advantages.

  1. Calling ASP. NET workflows: bearer and restrictions
  2. Create and start an ASP. NET Workflow
  3. ASP. NET database connection class ClassConn and oledb database connection method
  4. Implementation of ASP. NET database Driver Class: DBHelper
  5. ASP. NET database operation class written in C #

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.