I am developing a website using VS 2008 (C#). My current mission is to develop a module that should perform the following tasks:
- Every 15 minutes a process need to communicate with the database to find out whether a new user is added to the “User” table in the database through registration
- If it finds an new entry, it should add that entry to an xml file (say
NewUsers18Jan2009.xml).
In order to achieve this, which of the following one is most appropriate?
- Threads
- Windows Service
- Other
Are there any samples available to demonstrate this?
Separate this task from your website. Everything website does goes through webserver. Put the logic into class library (so you can use it in the future if you will need to ad on-demand checking), and use this class in console application. Use Windows “Scheduled task” feature and set this console app to run every 15 minutes. This is far better solution than running scheduled task via IIS.