[ASP.NET]How Long Will HTTPHandler Intance Be Pooled

If the IsReusable property is set to true. How long will the instance be pooled?     
It is pooled for the life of the application pool. And, it seems we are not able the control the time span.

public class HttpHandlerTest:System.Web.IHttpHandler {
     private int i = 0;
     public bool IsReusable {
         get { return true; }
     }
    
public void ProcessRequest(HttpContext context) {
     context.Response.Write(i++);
   }
}

Oh, wait. Actually, we can control the pooled time. By default, in IIS7. Work Process will be idle time-out in 20 minutes.
In other words, if no more request arrive for the web site in 20 minutes, All pooled HttpHander instances will be GCed.

So, to prolong the HttpHander instance pooled time. We can increase the "Idle Time-out(minutes)" property.

 

blog comments powered by Disqus