Willy
Willy

Reputation: 10660

WCF service, launch a task every X hours

I have a WCF service which needs to perform some actions on database every 1 hour and also needs to generate a file with some information.

So which is better, do it through a timer or thread?

The problem of thread would be the constant iteration (with a little delay) on a loop checking if the time has elapsed and if so do the action.

Any ideas on how to achieve this scenario the most efficient possible?

Upvotes: 0

Views: 513

Answers (1)

Uriil
Uriil

Reputation: 12628

Sounds like you need long running service.

WCF by it self not good solution.

You should look at Windows Services or WCF + WF hosted in app fabric

One of the reasongs, WCF does not support autostart, so you will have to start it every time after pool recycle(if you host in IIS, or any other hosting process)

Upvotes: 1

Related Questions