ASP.NET MVC3如何使用计时器一小时间隔EXCUTE控制器的操作方法 [英] ASP.NET MVC3 how to excute action method of controller using timer with interval of one hour

查看:512
本文介绍了ASP.NET MVC3如何使用计时器一小时间隔EXCUTE控制器的操作方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我使用asp.net MVC3。我有有一个特殊的动作方法的一个专用控制器。我需要使用定时器,一个小时的时间来执行这个操作方法。

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.

感谢

推荐答案

我能够使用VB脚本和窗口的时间表来解决问题日。请按照以下步骤。

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


  1. 请VB脚本像下面打电话给你的控制器动作。给喜欢schedule.vbs一些名称

  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


  • 请schedule.vbs文件的Windows日程中,只要你想。如果有一个执行schedule.vbs文件权限问题,请给予必要的权限了。

  • 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.

    感谢

    这篇关于ASP.NET MVC3如何使用计时器一小时间隔EXCUTE控制器的操作方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆