I need to perform some events (sending emails, etc.) based on time. What is the best way to accomplish this in ASP.net in a hosted (medium trust) environment?
ex:  Send email every day at 4:00pm.
ex:  Send email after 15min of login.
ex:  Send email after 10 hrs of last change to status.
The triggering logic can be complex on some of the requirements, so I need to build a flexible system to handle these sorts of events. I am stuck on the core activation method for this code.
Here are the options I have so far...
1) Timer in Global.asax
   + Simple
   - Is not reliable, the web application can unload in IIS and the event will not fire.
   ? Possibly use external pinger service to keep app alive (reliable?)
2) Windows Service to perform action
   - Slip/Maintain separate code.
   - Can not install in hosted environment (shared/cloud hosting)  
3) Windows Service to call Web App (calls webservice or runs page)
   + All code in web app
   - Can not install in hosted environment.  
4) SQL Server Job to call a Webservice (via CLR)
   ? Haven't looked at this.. possible? reliable in hosted environment?  
5) SQL Service Broker Timer to add message to call WebService (via CLR)
   ? Haven't looked at this.. possible? reliable in hosted environment?  
6) Windows Workflow?
   ? No Idea.. does this technology have anything for this?  
This seems like a common enough problem, are there third party tools to handle this?
I have had the same problem, and I agree totally with your analysis. My best solution to date is having an external scheduling application in a computer I control; that application requests the web page that actually does the things.
Ugly but it works, and I have searched for other solutions, believe me!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With