asp.netasp.net-mvcasp.net-4.0evented-io

Async IO with HttpResponse Asp.Net pre-4.5


In particular, I'm after a similar capacity to Response.BeginFlush being introduced in Asp.NET 4.5 which uses I/O Completion Ports.

I fear that this may not be possible because pre .NET 4 simply doesn't seem to expose enough to implement async IO with HttpResponse. IHttpAsyncHander is as far as things are exposed currently. It doesn't seem like there's much hope with integrating HttpListener.

I also looked into SignalR with Asp.NET which seems to have the dependency on .NET 4.5.

How screwed am I?


Solution

  • Seems like it's not possible. Asp.NET simply exposes HttpResponse/HttpRequest to IHttpHandlers which really the most control it allows. You can add a filter when writing to the IO stream, but Streams before .NET 4.5 didn't support for asynchronous flushing. And I don't think Asp allows a custom implementation of Streams.

    Edit: Asp.NET does not allow support for asynchronous writing.