I'm developing a web app that users can save a scheduled sms reminder in it. I wanted to use Quartz as my scheduler within a windows service to handle the sms part but my question is how can i communicate between my website and the windows service? i.e : on sms notification register on website I want to make a timed scheduled job for that sms in the windows service. is that possible? I was following this post to have a webservice inside my windows service but the windows service gets stopped right after starting due to some error.
Asked
Active
Viewed 139 times
1

Soner Gönül
- 97,193
- 102
- 206
- 364

arash moeen
- 4,533
- 9
- 40
- 85
-
1Are you not going to have some sort of persistent storage (eg database) of the SMS reminders? In which case they don't need to communicate directly, you just store the SMS reminder with the webservice, and have the windows service read reminders from the storage mechanism (and mark them processed when they get processed) – James S Apr 08 '14 at 11:12
-
Tell me if I'm wrong, you mean I keep the registered SMS in my database with their scheduled time and content via my website and then read it from the windows service? if that's the case shouldn't I read from that table like every minute? to ensure the SMS is sent on the right time? – arash moeen Apr 08 '14 at 11:15
-
exactly! You can just have the windows service on a sleep/execute loop - or even just use a CLI app instead run by the windows task scheduler – James S Apr 08 '14 at 11:19
-
so basically the service will execute every 1 minute and then goes back to sleep, wouldn't it put some load on the server? – arash moeen Apr 08 '14 at 11:28
-
Not really - a sleeping service by definition isn't using any CPU resource, and when it runs its only doing a quick lookup in the database, which shouldn't be overly taxing. Obviously if it has to send an SMS thats going to use some resource, but that happens anyway – James S Apr 08 '14 at 12:47
1 Answers
1
I'll side-step your requirement of using a Windows Service because I believe you don't need one. You can use the Quartz.NET scheduler inside a normal IIS website. Quartz.NET can use the database to coordinate job execution. This solution is clustering-ready and safe in the presence worker-process shutdown.
Probably this is by far easier than managing a Windows Service. Especially the deployment story is easy for IIS sites.

usr
- 168,620
- 35
- 240
- 369
-
makes sense but I'm worried when IIS recycles it wouldn't run the quartz until a request goes to the website?? – arash moeen Apr 08 '14 at 11:40
-
Good question. I strongly suspect this is a solved problem because Quartz is *made* for this use case. I can't answer that but I guess you'll find the Quartz.NET documentation interesting.; Even if this problem exists you can solve it by requesting some URL from your website once per minute to force it to start. Still much simpler than a service (which is quite hard). – usr Apr 08 '14 at 11:55
-
I found this http://stackoverflow.com/questions/11140597/iis-app-pool-recycle-quartz-scheduling solving the IIS recycle problem, so if I'm able to pre load my quartz after each recycle, then storing the jobs in database and checking on them to re create the jobs after each IIS recycle would do the job, is that right? – arash moeen Apr 08 '14 at 12:17
-