[英]ASP.NET script “scheduling” question
I am looking for a way to have a script run every day at 5am to delete the contents of a Temp folder. 我正在寻找一种方法让每天凌晨5点运行一个脚本来删除Temp文件夹的内容。 The following is the method I am considering.
以下是我正在考虑的方法。 I would appreciate any thoughts on this or suggestions for other methods.
我很感激对此的任何想法或其他方法的建议。 I want to keep everything local, so that there are no external dependencies from outside my account on Discount ASP hosting.
我希望将所有内容保留在本地,以便在我的帐户外部没有折扣ASP托管的外部依赖项。
Your comments are appreciated. 您的意见表示赞赏。
您还可以创建Web服务来执行任务,然后让计划任务定期调用Web服务。
This isn't a good idea, as you are depending on input that might never come to execute an operation which has a need to be performed on a regular basis. 这不是一个好主意,因为您依赖于可能永远不会执行需要定期执行的操作的输入。
Because of that, you need input from outside of the site (since the site is triggered by requests) to trigger your event, in other words, a scheduler. 因此,您需要从站点外部输入(因为站点由请求触发)以触发您的事件,换句话说,即调度程序。
You should be using a Scheduled Task for this. 您应该使用计划任务。 If you aren't, then you should have some other process which will send the event to the site (expose a web method perhaps) which on the schedule you desire.
如果你不是,那么你应该有一些其他的过程,将事件发送到网站(也许是一个网络方法),按照你想要的时间表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.