Designing an Asynchronous Task Library for ASP.NET

ASP.NET runtime is designed for short workloads that can run in parallel. I need to be able to schedule periodic events and background tasks that may or may not work for longer periods.

Given the above, I have the following problems:

  • AppDomain may shut down due to changes (Web.config, bin, App_Code, etc.)
  • IIS regularly recycles AppPool (daily)
  • IIS itself may reboot, or if this happens, the server may crash

I'm not sure that running this code inside ASP.NET is not what you need to do, because it will allow you to use a simpler programming model. But this will require that the external service periodically make requests to the application, that the application runs in keept mode, and that all background tasks are programmed with utmost care. They will need to be able to suspend and resume work in the event of an unforeseen error.

My current line of thinking is something like this:

If all tasks are registered in the database, it should be possible to use the database as an accounting mechanism. In case of an error, the database will contain all the state necessary to resume the operation at the next opportunity.

I would really offer some feedback / tips on this. I was considering starting a Windows service and using some RPC solution, but I don't have the same appeal for me. And instead, I will have a lot of deployment problems, and the tasks associated with synchronization and code overlap with multiple applications. Due to my business needs, this is less than optimistic.

+5
source share
4 answers

This is a shot in the dark, because I do not know which database you are using, but I would recommend that you consider interactive timers and activation. , , , , , , ( /, , msdb), , , , . , , , , ​​ .

.

, , , " ".

+4

Quartz.Net. , .

+2

. , . Windows .

FWIW, , ASP.Net, ( , ), , , .

, , - 30 , , 30 29 2 (, ), ASP.Net- - .

(, Cache ASP.Net) " ".

Windows, . , :

1) WCF OR

2) , , OR

3) , , . , . - , (, , , , ).

, - . , , WCF ( , - ).

+2

, .

Atzenta​​strong > , (1-2- ). , . jobID, , , , .

. , . , . ( - , ). System.Timers .

.

, , Atzenta​​strong > . , , . .

. , , , | | | | | |

- (, ).

global.asax Application_Start, Application_End , . , , Application_End, , , , , application_start.

, : Atzenta.RunTheJob(Jobs.StatisticUpdate, ProductID); , , , .

, -, . , .

- , .

+1

All Articles