My question is not how to call a web page in code but rather what the correct architecture for it would be.

I have an MVC web app that displays certain data from our database when the user visits a page. The data in question comes from another site, and I need to load it into our database once an hour by calling the other site's web service.

My question is, should I have a separate Windows Service running on my server that calls the page and inserts the relevant data into our database, or should this be done on a timer directly from the web app? That seems like it would be a weird way to go about it but perhaps this is standard? We already have a program running on the server that calls an ashx handler once every so often and I could easily write a controller to handle this, I'm just curious what the current best approach is. I did some searching for timer events on the server side in web apps and while I found answers, there were also a lot of "it sounds like you are going down a rabbit hole/XY problem/etc and I'd like to know the proper way.

1 Answer 1


I would argue on the side of the service/scheduled task to update the data.

Your web application can become dormant, or unused for a period of time. IIS will at this point put all instances of the worker processes running your application to sleep.

Speaking of instances of worker processes. They are completely unaware of one another and having multiple timers, one for each worker processes in IIS, could possibly lead to unexpected results in the DB. And possibly the external site to like you less for calling for the same data N times instead of 1 at the same or nearly the same time.

A single service with a timer, or just a console application called by windows task scheduler seems like a cleaner solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.