从Windows任务调度呼叫MVC控制器 [英] Call MVC Controller from Windows task scheduler

查看:163
本文介绍了从Windows任务调度呼叫MVC控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/11101636/asp-net-mvc3-how-to-excute-action-method-of-controller-using-timer-with-interval\">ASP.NET MVC3如何使用(一小时)的间隔定时器EXCUTE控制器的操作方法

Possible Duplicate:
ASP.NET MVC3 how to excute action method of controller using timer with interval of one hour

我使用ASP.NET MVC 3,我有作业调度一款专业控制器。我需要在每天的午夜从Windows任务调度程序调用这个控制器(比如调用从Windows任务调度.bat文件)。

I am using ASP.NET MVC 3. I have one special controller for job scheduler. I need to call this controller every night at midnight from the Windows task scheduler (like calling a .bat file from windows task scheduler).

有人告诉我,这是可以使用VB脚本。我们可以从Windows任务调度程序和VB脚本中调用VB脚本将调用ASP.NET MVC控制器。但我不知道如何做到这一点。

Somebody told me that this is possible using VB script. We can call VB script from Windows task scheduler and VB script will call ASP.NET MVC controller. But I do not know how to do this.

如果任何人有任何想法,请与我们分享。

If anybody has any ideas, please share with us.

推荐答案

您使用的 WebClient的类:

using (var client = new WebClient())
{
    string result = client.DownloadString("http://example.com/somecontroller/someaction");
}

这篇关于从Windows任务调度呼叫MVC控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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