Autostart A Website At Specific Time In IIS Or Avoid Time Delay On First Load Of Website After Application Pool Recycle
If the version of IIS is below 7.5 it will be difficult. But if it is 7.5 or above do the following steps.
For version 7.5, install this : Application Initialization Module for IIS 7.5.
For version 8.0 and above, its already available there. No further installation is required.
After a machine restart, On Run type inetmgr to open IIS.
On IIS select your Website.
Right Click on the Website and select Manage WebSite and then select Advanced Settings.
A new windows will be opened where you can find the settings of that website.
On the General Section, note down the name of the Application Pool.
Now open C:\Windows\System32\inetsrv\config
\applicationHost.config on Notepad.
Navigate to node of your website name.
Modify startMode to AlwaysRunning.
Now navigate to node
For Sub Node application, make true for preloadEnabled
Upto these steps definitely will avoid the time delay for loading website first time
after the Application Pool Recycle.
Now for autostart of your website at specific time, click on your application pool on IIS.
On right Action Panel, click Recycling Link under Edit Application Pool.
A new window will be opened as given below.
Select the specfic time as selected on the image.
On your Website's Default page, check for the early given time and do the rest.
if(Time == "12:00 AM")
{
//do your stuff
}
This is because, when application pool recycle happen, the app will again restart automatically.
It will trigger the default.aspx page of your site.
Else, if you want a particular page then provide the following on your Web.config file.