Ryan Mick posted on September 24, 2008 12:31

Recently I have encountered the "Why does my website take so long to come up" problem. The problem isn't the website, it's IIS. When IIS determines that a website has been inactive for a while it unloads it to reclaim resources until it is requested again. Now this becomes very aparent if you do any work with DotNetNuke. So what is the solution you ask? Well there are many ways to accomplish this task. A search on the web will reveal several that range from free to subscription based, my ISP even offeres a solution for a scheduled task that keeps the site up (for a fee). A website called Renegade Minds offers a free solution and seems to be the most populare one out there. My only problem with it is that it can only process one website. I already knew how to accomplish this task so I decided to create my own solution with the following requirements:
- Allow the configuration of multiple websites
- Allows the user to start and stop the process
- Allow the ability to configure a downtime for the website so IIS could recover resources
Now I'm not going to go into the step by step process of creating this application but I will discuss the key points of the application in detail. The application is a standard C# windows application created in VS 2008 utilizing a SqlExpress database in the project. The database contains one table and one stored procedure. The project utilizes two forms and two custom objects.
The Database
WebSite Table Schema
| Field Name |
Data Type |
Info |
| ID |
Int |
Primary Key, auto incrementing |
| Name |
varchar(50) |
|
| URL |
varchar(250) |
|
| Interval |
Int |
The time in minutes between processing |
| Flag_AllowDowntime |
Bit |
Setting to true will allow the website to enter downtime |
| Downtime |
DateTime |
Even though this is a datetime field we are only concerned with the time portion. |
| DowntimeInterval |
Int |
The time in minutes after the downtime to not process |
| Flag_Enabled |
Bit |
This will enable or disable the website from processing |
The stored procedure just simply returns all enable records from the table