Designing an asynchronous task library for ASP.NET
<p>The ASP.NET runtime is meant for short work loads that can be run in parallel. I need to be able to schedule periodic events and background tasks that may or may not run for much longer periods.</p>

<p>Given the above I have the following problems to deal with:</p>

<ul>
<li>The AppDomain can shutdown due to changes (Web.config, bin, App_Code, etc.)</li>
<li>IIS recycles the AppPool on a regular basis (daily)</li>
<li>IIS itself might restart, or for that matter the server might crash</li>
</ul>

<p>I'm not convinced that running this code inside ASP.NET is not the right thing to do, becuase it would allow for a simpler programming model. But doing so would require that an external service periodically makes requests to the app so that the application is keept running and that all background tasks are programmed with utter most care. They will have to be able to pause and resume thier work, in the event of an unexpected error.</p>

<p>My current line of thinking goes something like this:</p>

<p>If all jobs are registered in the database, it should be possible to use the database as a bookkeeping mechanism. In the case of an error, the database would contain all state necessary to resume the operation at the next opportunity given.</p>

<p>I'd really appriecate some feedback/advice, on this matter. I've been considering running a windows service and using some RPC solution as well, but it doesn't have the same appeal to me. And I'd instead have a lot of deployment issues and sycnhronizing tasks and code cross several applications. Due to my business needs this is less than optimial.</p>
