Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Periodic tasks inside WCF service hosted in IIS

Tags:

wcf

timer

We would like to have some periodic actions executed by our WCF service hosted in IIS. What is the best way to do this? Creating a timer doesn't look as a good solution. Creating a windows service that would behave as some kind of a heart beat looks like a problem solution, but it still doesn't smell good. What approach will be a good solution to this problem?

like image 419
Aleksandar Vucetic Avatar asked Nov 06 '22 18:11

Aleksandar Vucetic


1 Answers

That depends on what your action is trying to do. If it's a database related clean up action, e.g. deleting orphaned shopping carts, you could schedule a job for this in your database of choice, like SQL Server's very reliable job engine. A Windows service would be a great candidate if it's an OS based action like periodic clean up/deletion of files etc. Since an IIS/WCF service is usually designed more to handle external responses I don't think it'd be wrong to use the service layers of the OS or DB for your task.

like image 73
Codewerks Avatar answered Nov 15 '22 07:11

Codewerks