本文介绍了定期自动点击按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个生成其他团队上传的小图像的放大影像,并停止,如果没有图像上传文件夹中留下了一个Web应用程序。

I have a web application that generates enlarged images of smaller images uploaded by other team and stops if no image is left in uploaded folder.

一个按钮需要点击开始生成图像,并重新启动每次完成时间。

A button needs to be clicked to start generating image and restart every time it finishes.

可以这样click事件被以固定的间隔自动发射的15分钟或者说更好的仍然只是作为应用程序停止。

Can this click event be fired automatically at regular interval say at 15 minutes or better still just as the application stops.

有一个类似的问题,有人问较早线程 。

A similar question was asked on earlier thread How to write C# Scheduler .

private void OnTimerTick()
{
    if (DateTime.Now.Minutes % 15 == 0)
    {
        // Do something
    }
}

我应该

放在哪里定时器低于code称呼?

Where should I place timer to call below code ?

protected void btnImgGenerate_click()
{
    // Application code
}

有没有一种方法来检查在asp.net web应用程序是否已经停止执行,然后自动重启呢?

Is there a way to check whether a web application in asp.net has stopped executing and then restart it automatically?

使用定时器,我可以安排应用程序启动和在每天的特定时间停止,并保持应用程序中使用第二种方法在整个一天的指定时间运行。

Using timer, I can schedule application to start and stop at specific time of day and keep application running throughout specified duration of day using second method.

推荐答案

您可以添加code从在Global.asax文件System.Threading命名空间初始化定时器并配置它来执行与所需periodicy一些功能。但是,如果你的应用程序崩溃,你会得到以下问题:

You can add code to initialize timer from the System.Threading namespace in Global.asax file and configure it to execute some functionality with desired periodicy. But if your application crashes you'll get following issue:

有没有一种方法来检查在asp.net web应用程序是否有
  停止执行,然后自动重启呢?

使用定时器,我可以安排应用程序启动和在特定停止
  一天中的时间,保持整个指定时间运行应用程序
  一天的使用第二种方法。

Using timer , I can schedule application to start and stop at specific time of day and keep application running throughout specified duration of day using second method .

不。您不能从自身开始网络appliccation如果它停止了一些原因,并没有新的要求来。所以在我你的目的看法更适合Windows服务。

Nope. You can't start web appliccation from itself if it stopped by some reasons and no new requests comes. So in my opinion for your purpose better suited a windows service.

这篇关于定期自动点击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 23:09
查看更多