views:

21

answers:

0

Hi all,

I have an ASP.NET MVC application that transmits audio files via a "Music" Controller and "Music" ActionResult. With this, I can serve files through our routing engine (i.e. www.mysite.com/music/stream/id=42) and do other nifty server-side stuff like logging.

I also have a Flash music player (developed by a contractor) to receive and play these files. Here's the problem: let's say I play a file -- it begins to download. Then, before the download completes, if I pause then re-play the file, a new request is sent and a second download is initiated. The Flash player is held up, as it has to wait for the first download to complete before it can download the second instance, and even then, it won't play until it downloaded the second instance up to the current paused position.

This only happens when pulling files off our ASP.NET MVC application running on IIS 7.5. When the player runs in an Apache sandbox and pulls sample files directly (i.e. www.sandbox.com/music/file.mp3,) only a single request and download is initiated. I can pause and re-play, and it will replay from the same download.

Note that once a file has completely downloaded, the issue goes away because the file is cached.


In examining headers with Fiddler, I noticed responses pulled from the sandbox server include the Connection: Keep-Alive header. Responses pulled from our IIS server do not. Other than this difference, the headers from sandbox responses are identical to our IIS responses.

Thus far, our best assumption is that the issue has to do with the missing Content: Keep-Alive header.


We have tried several different transmission methods within our ActionResult. We've tried Response.BinaryWrite(), Response.TransmitFile(), and even a manual stream (which is our current configuration.) None of these methods has solved the problem.

ContentType is set to "audio/mpeg", Content-Disposition is set to "inline" and Content-Length is to the file's length.

On the server, The Keep-Alive header is checked. I have no idea why it's not appearing if it's checked. For what it's worth, there's no Connection: Close in the header, and we're not calling Response.End() or Response.Close() after TransmitFile(), BinaryWrite(), or the output stream loop. (We've tried Response.End() on all three, but it didn't make a difference.)

Any thoughts, help, or advice would be greatly appreciated.

Thanks!

Mark.