Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a big problem. I have a database with data about a bidding site.
I would like to run a checking every 2 or so minutes to see if a bidding has expired or finished by buying, and send messages to the users if the case.
The problem is that i use Microsoft Sql Server 2008 R2 Express, meaning i don't have Server Agent.
This is a project for a competition, so i would like that the scheduling was made from ASP.NET, and not using other web host stuff.

I've found a tricky solution, making use of the cache expire event, but i can't make it work.
http://beckelman.net/post/2008/09/20/Simulate-a-Windows-Service-Using-ASPNET-to-Run-Scheduled-Jobs.aspx

I use Visual Studio 2010, Microsoft SQL Server R2 Express, so if you can please provide compatible solutions.

Thank you for your help
Posted

A non-ASP.Net way to do this would be to add a console application project to your solution. One way to build it would have a main controller thread, responsible for scheduling/instantiating two worker threads.

One worker is responsible for keeping your database mirrored/synched with the remote service (continuously monitors the database for items which are not expired && not refreshed within the past X minutes).

Another worker is responsible for monitoring your items for changes (expiration, etc) and raising a notification event.

The final worker is responsible for sending the notifications via in-site message, email, sms, etc. You could trigger this worker through events passed through event aggregation service.

Your console application can run on any machine that has access to the database, doesn't have to be the SQL or Web box specifically. Depending on how you build it, you could have the workers "pick up" where they left off, in case the service is turned off for a period of time.

Hope this helps, good luck with the competition.
 
Share this answer
 
Comments
Shaman203 30-Nov-10 5:15am    
Thank you
Create a page that calls the code behind for the page every 2 minutes. That code behind method would then do any checking against the database that is required. You could perform the call however you like (e.g., force the page to refresh every two minutes, or just use a JavaScript timer and call a Page Method every 2 minutes).

You could then keep that page open constantly... you could probably even have the page open on the server itself (which may be your local computer if you're just debugging). As long as a browser is open and pointing to that page, that page can interact with the database.

You could also create a Windows Service, but depending on your setup, that may or may not be workable for you. Also depends on what you mean by "send messages to the users". If you mean email, then a service would work. If you mean to the webpage they already have open, that can be accomplished using the above technique (page methods or timed postbacks).
 
Share this answer
 
Comments
Shaman203 29-Nov-10 16:49pm    
Messages are managed via the web page , the users have a message box filled with reports about their bidding , products etc.
How to keep open a page on the server?
And how to make the job to run, if no one accesses the website?
And thanks for the previous ideas
AspDotNetDev 29-Nov-10 17:18pm    
You keep a page open on the server by opening it on the server and then not closing it. What "job" are you running? The page is to be left open on the server so that it can act as a job (i.e., it can periodically hit the server). That open page IS "somebody" (in this case, the server itself) accessing the server. You could, however, leave the page open on any computer you want.
Dalek Dave 29-Nov-10 18:00pm    
Good Call.
Shaman203 29-Nov-10 18:15pm    
I understand. Thank you

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900