0

Possible Duplicate:
ASP.Net:Best way to run scheduled tasks

I have to make a scheduled task for a ASP.NET application. The App have to generate a file and put it on a directory. Simple task in fact but I don't know how to handle the scheduled property. I though to make a webservice in the Web app and make a little service to install on another machine who do the sheduled 'writing' task with the webservice's data's.

Too complicated? Is it possible to ask the webApp to daily make this job? Is really good to ask a webApp to do scheduled tasks?

How can I do that and what is the best way for you thanks..

Community
  • 1
  • 1
bAN
  • 13,375
  • 16
  • 60
  • 93

2 Answers2

6

Just use Windows Task Scheduler and set it to run your app daily at the desired time. It's perfect for this sort of job.

dtsg
  • 4,408
  • 4
  • 30
  • 40
0

I wouldn't get the web app to run the task. If the code you need to execute exists in the web app and needs to be accessible from the web app, then you can move it to another project in the same solution as your web app (and compile it as a dll).
Then you can create a third project (compiled as a .exe) that also references the dll. Copy that .exe and the .dll on a machine and schedule the task with task scheduler :)

as a tree view of your Visual Studio solution:

Solution
-Project 1: dll
-Project 2: web app (references Project1)
_Project 3: exe (references Project1)

NDUF
  • 687
  • 6
  • 14