2

Hello

i am using asp.net mvc3. i have one special controller which have one special action method. i need to execute this action method using timer with the interval of an hour.

any best and efficient idea.

thanks

6
  • possible duplicate of Scheduling in Asp.net.What is best solution?
    – jrummell
    Commented Jun 19, 2012 at 13:17
  • Can you use a Windows Scheduled Task instead? ASP.NET isn't designed for this.
    – jrummell
    Commented Jun 19, 2012 at 13:18
  • I agree with your second comment @jrummell but not the first. If any one searches for the keywords in this question in google, he/she will never get to the other question. You could simply answer redirecting to the other question and the question would be answered. Commented Jun 19, 2012 at 15:28
  • @FabioMilheiro, my understanding of SO is that answers that link to other answers are discouraged since that would imply that the questions are the same, even if they are worded differently.
    – jrummell
    Commented Jun 19, 2012 at 17:42
  • Duplicate syndrome is the only problem with this site. Just trying to help solve it but won't be involved in an argument over it. Commented Jun 19, 2012 at 22:27

2 Answers 2

3

i am able to solve th problem using VB Script and windows schedule. please follow the following steps.

  1. Make VB Script like below to call your controller action. give some name like schedule.vbs

    Call ScheduleTask() 
    
    Sub ScheduleTask()
    On Error Resume Next
    
    Dim objRequest
    Dim URL
    
    Set objRequest = CreateObject("Microsoft.XMLHTTP")
    URL = "http://localhost/controller/action"
    
    objRequest.open "GET", URL , false
    
    objRequest.Send
    
    Set objRequest = Nothing
    
    End Sub
    
  2. make windows schedule of "schedule.vbs" file as you want. if there is permission problem for execute schedule.vbs file, please give the required permission to it.

thanks

1
  • Thanks, i want to send sms every day. should i add a schedule.vbs like this code, and then add a controller/action and set my sms code in this ??
    – Niloo
    Commented Mar 15, 2015 at 9:14
-1

Azure Functions to the rescue! It was designed for exactly this. You can schedule functions using a timer trigger.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.