Last post Sep 22, 2010 03:40 AM by Danish woman
Sep 15, 2010 04:52 AM|Danish woman|LINK
Hi I have created a SMS service on my website where the client can send SMS to mobile phone.
I want to make the client able to choose at what time the SMS has to be sent.
The SMS is sent going to this url:
My idea was to run a windows server simulation from Global.asax that checks every 30 minutes if there is any sms to sent out.
But I think that maybe there is a better way.
I have not tried to make a Windows Service yet and maybe it could be better that way. (I am not using visual studio, but handcoding)
Sep 15, 2010 07:45 AM|parthasbhadra|LINK
My idea is to create a Windows Service that will run check periodically for sending SMS.
You can get idea of Windows Service from the following links
Sep 15, 2010 07:50 AM|toas1|LINK
One possible solution would be to put an object in the aspnet cache with absolute expiration set to the time you want your sms to be sent. Make sure you add a callback to a method that actually sends the sms when adding to the cache. The object you cache
could be an instance of an "SendSMS" class containing phone number, message etc. Only problem with this is that its not bullet proof, if your application shuts down you may loose some messages.
Hope this helps.
Sep 16, 2010 02:53 AM|Danish woman|LINK
Thank you both for you replay.
The cache solution was what I talked about doing in Global.asax. I did something similar in another application and the reason why I would like to do something else like Windows service is that the cache solution isnt very stabil, and the SMS has to be sent out
at exactly the time that the client choose.
About the Windows service, thank you for the links. My problem is that I dont use (dont want to use) Visual Studio. I like to handcode because then I know exactly what I am doing.
I was making the file for Windows Service and the file for Windows Service Installer. Then I read that I have to install the Service with Visual Studio. Is there a way to install Windows Service without Visual Studio?
Sep 16, 2010 04:21 AM|parthasbhadra|LINK
As per I know For installing Window Service either you can create a setup project or you can install in from VS command prompt…
But for both of this you need to install Visual Studio
Sep 16, 2010 01:08 PM|Wilmar|LINK
If you are saving it into an SQL Server the you can take advantage of the scheduled job feature:
I hope this helps.
Sep 17, 2010 01:12 AM|Danish woman|LINK
Thank you for reply.
I am using mySQL database.
I have never used Stored Procedure. Can it work also with mySQL?
Sep 17, 2010 04:04 AM|toas1|LINK
The cache solution was what I talked about doing in Global.asax
There is a big difference between using the cache like I suggested and using a timer in the global.asax (where you check every 30 mins). I think that in your case using the cache would be a good solution since you will get a notification on the exact time
when the sms should be sent. you can also store it in the cache with highest priority to make sure that nothing get kicked for storage reason and if the application gets recycled you can also handle that by adding code in the application_end where you store
any objects that are left in the cache to file and then load from this file on the applicaion_start.
Sep 17, 2010 12:40 PM|Wilmar|LINK
I don't think mySQL has the same feature. If you don'tlike to use SQL server then your only way is to create a windows service that will send emails periodically.
Sep 18, 2010 05:22 AM|Danish woman|LINK
It seems that I misunderstood your last suggestion. I tried to google asp.net cache, but I didnt find a article what talked about cache in a way that I understand exactly what you mean.
Do you have a link to any article?
Sep 18, 2010 07:28 AM|toas1|LINK
Sep 18, 2010 09:17 AM|Danish woman|LINK
Thank you for the links.
So if I understand right, I can choose to send my SMS out 72 hour from now, setting the cache expiration to 4320 minutes. In the CacheItemRemovedCallback I make a function to send out the SMS.
But what happens if the server is restartet between now and the 72 hours or if the server restarts exactly 72 hour from know. Will the SMS be send out when the server restarts or will the SMS not be send out at all?
Sep 18, 2010 10:20 AM|toas1|LINK
in the application_end event you can save whats in the cache to file and then load in it back in to the cache from this file in the application_start event when your application start up again.
Sep 22, 2010 03:40 AM|Danish woman|LINK
Thank you Toas1.
This can work very well and is a good alternative to windows service.