vivek jain
vivek jain

Reputation: 591

How to implement WCF Service which does polling or checking database after a certain time interval

I have a requirement where I want to implement a WCF Service which checks a status from a Database column after a certain time interval lets say 20 minuets, if this status is true I want to execute some operation else some other operation. So is it possible to implement the desired functionality using WCF Service, If yes please guide me how should I implement, As I have no idea how to do it.

If its is not possible, then please suggest me some good options like (Web Services, windows service etc.). Please provide me sample code or some good links where I can find the way to approach this problem. I want this service to run on my PC always and check status after 10-20 minuets. I am more comfortable with C#, So If it could be done in C# its well and good. Otherwise also not an issue. I have windows PC

Upvotes: 0

Views: 1830

Answers (3)

Uriil
Uriil

Reputation: 12618

There are two common options: 1) windows service 2) long running service in AppFabric

Depending on production environment, second one might be not acceptable. But it have real benefits:

1) you don't need admin access to server

2) you can use FTP/Web Deploy publishing

3) you run service in IIS with all it cons and pros

Upvotes: 0

Vladimir Perevalov
Vladimir Perevalov

Reputation: 4159

I think you miss the idea of WCF and only see word "service". WCF service is used to call some code on the server from remote machine. It is not supposed to do any work on its own. Only when called. By your description, you should create a Windows Service, which should have a loop. It will look how much time has passed and execute your action.

Upvotes: 1

nvoigt
nvoigt

Reputation: 77294

What you describe is a Windows Service. A Task running in the background, even without an active user login, that executes code periodically. Look up a tutorial on Windows Services, maybe start with the Visual Studio template for building one.

Upvotes: 1

Related Questions