I would like my web service to call a clean up routine every X hours, with no input from any user, or any call to “Start Clean up Services”. I understand I can call a method to start this service, but I want no user interaction at all. I want to publish this service, and it automatically starts, and runs my clean up process every X hours.
Any ideas?
You can setup a timer in the
Global.asax.csfile that’ll go off every X hours, or you could also create a scheduled tasks that goes off every X hours as well to trigger the clean up service.If you do not have a Global file in the project you can simply add one by adding one to the project. To do this right-click on the project -> Add -> New Item, and then in the dialog that pops up in select Global Application Class and hit Add. Then inside the
Application_Startevent you can initialize your timer to perform the action.For more information on the Global file you may want to refer to MSDN