0

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?

Nadir Muzaffar
  • 4,772
  • 2
  • 32
  • 48

1 Answers1

0

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.

Nadir Muzaffar
  • 4,772
  • 2
  • 32
  • 48
  • 1
    There's no async write in ASP.NET. You can flush async in ASP.NET 4.5 though. – davidfowl Jun 11 '12 at 07:49
  • ASP.NET 4.5 also introduced asynchronous read/write without Begin(Read/Write). – Nadir Muzaffar Jun 11 '12 at 16:25
  • 1
    That's incorrect. There's no async write in ASP.NET 4.5. Its a buffered write. However you can flush async. – davidfowl Jun 11 '12 at 23:58
  • Are the [Response.Output.WriteAsync](http://msdn.microsoft.com/en-us/library/hh158638(v=vs.110).aspx) and [Response.OutputStream.WriteAsync](http://msdn.microsoft.com/en-us/library/hh158629(v=vs.110).aspx) methods not asynchronous? – Nadir Muzaffar Jun 12 '12 at 00:10
  • And pre .Net 4.5, [Response.Output.BeginWrite](http://msdn.microsoft.com/en-us/library/system.io.stream.beginwrite.aspx) ? – Nadir Muzaffar Jun 12 '12 at 00:14
  • 2
    That's also synchronous. WriteAsync are on Stream and HttpResponseStream (the ASP.NET impl) doesn't override them. So like I said before, it's buffered write and async flush. – davidfowl Jun 12 '12 at 05:42
  • I just want to clarify, by write I don't mean send. So just want to reiterate, you're saying that WriteAsync will never return without having completely finished writing? By written, I don't mean send. It's understood that after a write, you often have to flush. – Nadir Muzaffar Jun 12 '12 at 08:27
  • There's no async write in ASP.NET. – RickAndMSFT Jun 12 '12 at 16:22
  • Alright, I'm taking your word for it. But where on earth is this specified in the documentation? I wasn't able to to find the documentation for HttpResponseStream. If it doesn't exist, it probably should. – Nadir Muzaffar Jun 12 '12 at 17:00
  • 2
    Yea, we're on the team, you should take our word for it ;). @RickAndMSFT should be able to answer that question. – davidfowl Jun 12 '12 at 19:18
  • Awesome, a kudos for how MVC4 Asp.NET 4.5 is coming along. Release it already! I'm quite anxious. – Nadir Muzaffar Jun 12 '12 at 19:20