Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can WCF be auto scheduled?

Tags:

wcf

scheduling

I have below requirements:
(1) Perform 'action A' when user requests for it.
(2) We also want to perform the same 'Action A' twice in a day even if users don't request for it.

I have a WCF web service which has method XYZ that performs action A. The method XYZ will be called when user requests for it.

Now question is, can I schedule this action without creating window service (which can host this service) or creating proxy?

Is there a way to perform an action by user request and schedule that same action, using only one application?

like image 884
sharp_net Avatar asked Aug 26 '11 01:08

sharp_net


1 Answers

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.

like image 96
Kirk Broadhurst Avatar answered Sep 23 '22 15:09

Kirk Broadhurst