You can do it a few ways.
- If you have control over IIS, you can change the "Idle Timeout" within the application pool, by default it is 20 minutes.
- If you do NOT have control over IIS (Shared or other hosting), you can use an external service to ping the site. MyWebKeepAlive or Pingdom are good options for this.
If you are under option two, I strongly recommend an external source, as it is less to manage, and if you don't have IIS available to configure, you most likely don't have the server available to add a ping application to.
In addition, I do not recommend something that sits in-process with the web application, as I have found that those can cause issues when the application really does need to recycle...
One last thought
If you do go the route of modifying the IIS Idle timeout, I do recommend setting a regular recycle of the application pool. As many web applications do benefit from a periodic recycle, and most commonly the idle timeout is the biggest regular recycle factor.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…