Reputation: 13762
We have an existing method in an existing controller that we'd like to call at a specific schedule (eg "daily at 2am"). The application is an MVC3 application running on Azure as a web role and we don't want to create, maintain and pay for an entire new role (worker role) just to run one small piece of identical logic.
Is it possible to schedule a controller method to trigger off at a specific scheduled time in the future? Also, would the same technique work in regular ASP.NET webforms?
Upvotes: 3
Views: 2240
Reputation: 2933
I've successfully used Cron jobs in a Shared hosting environment where scheduled tasks/powershell wasn't available.
Here's a website explaining more about it
Upvotes: 0
Reputation: 3693
Assuming you can just call this controller action with a URL, you can just... 1) create a PowerShell script to "ping" the website: http://learn-powershell.net/2011/02/11/using-powershell-to-query-web-site-information/ 2) Schedule that PowerShell script via remote desktop in a Scheduled Task that runs at 2am
You could also write a deployment script that automates #2.
Upvotes: 2