Events on a Timer

G

Guest

Hello,

I'm pretty new to asp.net programming and to these forums, so I hope that
I'm asking an appropriate question in the right place.

I'm helping to develop a web application in asp.net 2.0, vb.net, and I'm
trying to execute code every 10 minutes, starting at 6:00 am and ending at
10:00 am, every Monday thru Friday. Those exact times are rough examples,
and may change. So I think I need to create some kind of timer that fires an
event, on a defined schedule and interval, based on the clock on the server.
Does that sound right? Is there a good way to do that or should I be taking
a different approach?

If there is a better place to be asking this type of question, could you
please point me to a more appropriate forum?

Thank you.
 
P

Patrice

Is this is a server on which you don't have control ?

My personal preference would be by decresaed order :
- a schedule taks in my DB (if allowed such as SQL Server) or as a Windows
scheduled task
- a webcron like service (http://www.webcron.org/) fi you don't have control
on your computer
- messing with ASP.NET for such as task would be really my last resort
(remember that an ASP.NET page just lives the time of the HTTP request so
you would have to create and keep alive a thead that would'nt sruvice to an
application restart etc.. basiclaly you are tying articifcally something
that is unrelated to your ASP.NET application into your ASP.NET
application).

You may want also to explain what you'll do there as it could raise other
more focused suggestion.
 
G

Guest

Thanks for your response. I do have control, to some extent - I have an
asp.net 2.0 web site and MS SQL Server 2005 database on a shared, hosted
service. I can ask the service provider if I am allowed to do this kind of
timer?

What I want to do each time the timer fires is:

1. Retrieve an Xml document from another party using a URL
2. Read that Xml and put some of the information in a table
3. Run a stored procedure and perform some actions on my database
4. Create a new Xml file based on the results of the stored procedure and
send that Xml to another party

Do you know if I can do all of that from the SQL server database, based on a
scheduled task in the database? Or do I use the database task to fire an
event and then some other code the read and write the Xml? Or.....?

Thank you for your help.
 
J

John Mott

There are a variety of flavors of .NET applications, console, traditional
Windows, ASP.NET or a Windows Service. So, the platform itself (the ".NET"
platform) is the right place to be.

However, its all about the right tool for the job. In this case an ASP.NET
app is not the right tool for this job, in my opinion.

If it were me I'd write a console style application that was launched via
the Windows Task Scheduler. You don't need a user interface, it can write
log files if it needs to, and the great thing about console programs is that
when they are done all resources are freed -- they are gone gone gone.


john
 
C

Cubaman

Thanks for your response. I do have control, to some extent - I have an
asp.net 2.0 web site and MS SQL Server 2005 database on a shared, hosted
service. I can ask the service provider if I am allowed to do this kind of
timer?

What I want to do each time the timer fires is:

1. Retrieve an Xml document from another party using a URL
2. Read that Xml and put some of the information in a table
3. Run a stored procedure and perform some actions on my database
4. Create a new Xml file based on the results of the stored procedure and
send that Xml to another party

Do you know if I can do all of that from the SQL server database, based on a
scheduled task in the database? Or do I use the database task to fire an
event and then some other code the read and write the Xml? Or.....?

Thank you for your help.

What you need is a windows service, that starts automatically on each
reboot, no matter if a user is logged in, and also can restart in case
of failure. An programed task can not do this things.
Best Regards,
Oscar Acosta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top