Click here to Skip to main content
13,045,920 members (47,856 online)
Rate this:
Please Sign up or sign in to vote.
i want to create web service that 'll be published on internet
but i need the code inside it to be executed every 5 minutes so i think to add timer to repeat code executing but how i add timer inside web service or there's another solution
need for help
Posted 10-Nov-11 8:53am
Updated 10-Nov-11 17:51pm
Tejas_Vaishnav 10-Nov-11 23:53pm
that's not good idea to execute a code of web service after every 5 mints..
one thing i don't understand that what you want to try to execute in web service...
its for use to provide service on the request not automatically...
Tejas_Vaishnav 10-Nov-11 23:54pm
you can go for windows service for continuous execution of your code....
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi there,

The web service isn't a good place to do a timer. If there's work to do every 5 minutes, the web service is good to read the result or progress of that work, but not a good host for the work.

Your best bet is to go with a service (steeper learning curve) or a simple console app (easiest). The console app could be put into Windows Task Scheduler and called every x minutes to do its work.

The approach there would be that you would use a data store (such as SQL server) where you would put your results. The web service would read from those results.

Hope this helps you get moving in the right direction.

Tejas_Vaishnav 10-Nov-11 23:53pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

so nice solution offered .thanks ...

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 16 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100