简体   繁体   中英

Run ASP.net c# Web Application Automatically

I have a ASP.net web application that checks the status of my servers, it then wraps all this information up and puts it in a email. My Question how do I run this automatically say every day at like 2:00am, or like every 12 Hours?

Thanks

最好的解决方案是创建一个简单的MS Windows服务来完成这项工作。

You'd better implement this as a separate process from your ASP.NET application. Phil Haack has summarized the reasons in this blog post . A Windows service for example or even a console application using the windows scheduler could work just fine for this task.

You want a scheduler - I recommend Quartz.NET .

As others have said, your code doesn't have to be in a web app.

If it is, then schedule a job that uses WebClient to make a request to your web app.

Check out WebDriver .

It's intended as a test / qa framework, but there's nothing stopping you from using it in a console application, which you can then run as a Scheduled Task. Note that whatever machine runs the Scheduled Task has to have a browser that WebDriver can fire up.

The easiest solution would be to create a scheduled task on your server using the Windows Task Scheduler and setup this job so that it uses internet explorer to visit your webpage.

If you open the task scheduler and create a new task. In the "Run" field put:

"C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE""http://www.yoursite.com/yourpage.aspx"

Then in the "Start in" field put:

"C:\\Program Files\\Internet Explorer"

Now configure this task to run at 2:00am every day.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM