Click here to Skip to main content
15,881,561 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey Guys,

I need ur help.I want to implement a C# window Service which will be Calling Wcf Service after each 5 mintutes.


I have successfully called Wcf service but problem is that how can i make a call to wcf service right after 5 minutes from Window Service C#.


Thanks in Advance.

Regards

Aneeq
Posted
Comments
Afzaal Ahmad Zeeshan 19-Dec-14 5:51am    
Use a timer, set the Timer's time to 5minutes, and then inside the Elapsed event call the function...

1 solution

Refer - Can WCF be auto scheduled?[^].
Quote:

No, WCF cannot be auto-scheduled. You need to implement a Scheduled Task (see Scheduling jobs on windows), a Windows Service with a timer (which you've said you don't want to do, if I understand correctly) or some other application with a timer.


You could start a thread as per the other answer but this relies on your service calling itself - I'd prefer to call it externally, from another process.


A scheduled task can run an executable. You could write a console application that calls your WCF service, logs any result (if necessary) and then completes.


I normally prefer to implement this type of timer through a Windows Service, simply because the Windows Service can be monitored, can log, and can auto-start / auto-restart - install it and it 'just works'. If I didn't want to use a Windows Service then I'd schedule a task.

 
Share this answer
 
Comments
anik butt 21-Dec-14 5:28am    
Hey. No bro you got me wrong.Actually i just need a sample code for my window service to call any method(wcf but you dont need to worry about this) after each 5 mintues. ..
That is what I told. Just schedule that, it will work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900