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

3. May 2011

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.

 

ASPNET

Comments

5/4/2011 5:36:15 AM #
ya it is pooled for the life span .Good post.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading