hhh3112
hhh3112

Reputation: 2187

How can i execute a function at an exact hour every day, in ASP.net?

I have a function that needs to be executed every day at an exact hour. How can i do that in asp.net? Do i need to use a webService or do i need to install something on the server or something else? How can this be made?

Upvotes: 1

Views: 1111

Answers (3)

Cheeso
Cheeso

Reputation: 192467

ASPNET is a Request-driven model. It gets a request, for a document, a resource, a page... and then it runs some logic to generate that document, logic or page and transmit it to the requester. It's not set up to "run" by itself.

So you have a couple options: The way to get something to run at a particular time on Windows is via Task Scheduler. It's available on any recent Windows. You supply the EXE. In your case it might make sense to write a console EXE.
Use schtasks.exe (command line tool) or the control-panel applet to to set up the task, the login, the time and repeats.

The EXE could be an ASPNET client that makes a request to an ASPNET-managed resource. Or it could just directly do the thing you want - maybe it's reading a database and creating a report.

Upvotes: 0

Alex KeySmith
Alex KeySmith

Reputation: 17101

There are a variety of options, you could use:

Upvotes: 0

Kenoyer130
Kenoyer130

Reputation: 7308

You can use a Scheduled Task to execute a C# console app.

http://support.microsoft.com/kb/308569

Upvotes: 1

Related Questions