2

我在 Windows 2008 上有一个 IIS7 网站。从 java-script 我通过 http-handler 编写 mp3 文件:

var audio = document.getElementById("audio");
audio.src = GetMultimedia.ashx?F=" + filename;
audio.load();
audio.play();

获取多媒体.ashx:

 Response.ClearHeaders();
 Response.ClearContent();
 Response.Clear();
 Response.ContentType = "audio/mp3";
 Response.AddHeader("content-length", FileLength().ToString());
 Response.AddHeader("Connection", "keep-alive");
 Response.BufferOutput = true;

   GetFile(ref FileBuffer);  // I get buffer of mp3-file for writing to Response
   if (FileBuffer != null)
   {
     ms = new MemoryStream(FileBuffer, 0, FileBuffer.Length, true);
     if (Response.IsClientConnected == true)
     {
       ms.CopyTo(Response.OutputStream);
       Response.Flush();
      }
   }

问题:在 Windows 上任何浏览器都可以正常工作,但在 Android(Opera,内部浏览器)上 http-handler 工作 12 次(日志如下)。IIS 在此处理程序调用 11 次后写入 retcode 200 0 64。因此,响应中的 mp3 文件与原始文件不同,因为 http-handler 多次调用。

2012-11-11 15:54:13 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 64 1069317 261 8626
2012-11-11 15:54:13 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 2236677 261 8330
2012-11-11 15:56:15 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 140
2012-11-11 15:56:18 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 140
2012-11-11 15:56:22 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 296
2012-11-11 15:56:25 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 124
2012-11-11 15:56:29 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 249
2012-11-11 15:56:32 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 171
2012-11-11 15:56:35 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 140
2012-11-11 15:56:38 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 140
2012-11-11 15:56:41 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 140
2012-11-11 15:56:44 GET /GetMultimedia.ashx V=f.mp3 HTTP/1.1 stagefright/1.2+(Linux;Android+4.0.3) 200 0 0 255 284 109
4

0 回答 0