IHttpAsyncHandler Interface
Defines the contract that HTTP asynchronous handler objects must implement.
Assembly: System.Web (in System.Web.dll)
The IHttpAsyncHandler type exposes the following members.
| Name | Description | |
|---|---|---|
|
IsReusable | Gets a value indicating whether another request can use the IHttpHandler instance. (Inherited from IHttpHandler.) |
| Name | Description | |
|---|---|---|
|
BeginProcessRequest | Initiates an asynchronous call to the HTTP handler. |
|
EndProcessRequest | Provides an asynchronous process End method when the process ends. |
|
ProcessRequest | Enables processing of HTTP Web requests by a custom HttpHandler that implements the IHttpHandler interface. (Inherited from IHttpHandler.) |
An IHttpAsyncHandler class can be associated with a file name extension or a particular URL by a configuration file, in the httpHandlers configuration section. The ASP.NET infrastructure will then instantiate and call the handler when the corresponding request is received. Alternatively, the handler can be defined in an .ashx file and when the corresponding request is received for the .ashx file the hander will be executed.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
- 7/31/2011
- Omid Mafakher
Sometimes it's useful to create a FIXED number of threads to bound the IIS Asp.net threads that hand you the request. An example of this is if you have 1 thread constantly polling some other service and don't want all N requests threads blocking to essentially do the same operation. This one fixed thread can complete all outstanding N requests.
So please don't
- Pass them off to the threadpool. You'd might as well use IHttpHandler
- Create your own thread pool for each request (this is actually worse than using threadpool.) The example is contribed because the only work being done is sleep. You can make this thread efficient by having 1 sleep thread that goes around and finishes requests once they've been there for 20 seconds.
- Sleep or Wait on the Handle or call EndFoo unless your callback (that you specified in BeginFoo) has been called. This blocks the thread anyways and essentially makes your IHttpAsyncHandler an IHttpHandler
- 9/26/2010
- Hayling
The article points out that the best way of implementing the whole IHttpAsyncHandler "Stack" is to create your own thread manually and not use the delegate "BeginInvoke" or the ThreadPool.QueueUserWorkItem.
http://msdn.microsoft.com/en-us/magazine/cc164128.aspx#S4
- 7/17/2010
- BlitzkriegMDW