流文件到Chome Broken,Firefox工作

我写了一个ASP.Net网页,它将取一个
QueryString
并将文件流式传输到客户端。该文件存储在SQL Server数据库中。当我在开发期间在本地运行网站时,一切都很有效。当我从服务器上运行它时,我可以通过Firefox获取文件,但不能获得Chrome。在Chrome中,我得到了
Error 100 (net::ERR_CONNECTION_CLOSED): Unknown error.
看到其他一些提到这可能与
Content-Length
相关的帖子,但是,我无法理解为什么这会在开发而不是生产中起作用。出于这个原因,我认为这里肯定会有其他事情发生。 感谢您的任何建议/提示。 这是我的代码:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim Data_ID As String = Request.QueryString("Data_ID")

    Using dt As New Enterprise_Error_Log.Field_FileDataTable
        Using ta As New Field_FileTableAdapter
            ta.Fill(dt, Data_ID)

            If dt.Rows.Count > 0 Then
                Dim myRow As Enterprise_Error_Log.Field_FileRow = dt.Rows(0)
                Dim myFileName As String = myRow("Field_File_Name")
                'Dim myFileData() As Byte = myRow("Field_File")
                Dim myFileLength As String = myRow("Field_File_Length")

                Response.BufferOutput = False
                Response.AddHeader("Content-Disposition", "inline;filename=""" & myFileName & """")
                Response.AddHeader("Content-Length", myFileLength)

                StreamFile(Data_ID)

                Response.Close()

            End If

        End Using
    End Using

End Sub

Private Sub StreamFile(ByVal Data_ID As String)
    Dim bolGotContentType As Boolean = False

    Using conn = New SqlConnection(Enterprise_Error_LogConnectionString.ConnectionString)
        Using cmd = conn.CreateCommand()
            conn.Open()
            cmd.CommandText = "SELECT Field_File FROM Ext_Error_Log WHERE (Data_ID = @Data_ID)"
            cmd.Parameters.AddWithValue("@Data_ID", Data_ID)

            Using reader = cmd.ExecuteReader(Data.CommandBehavior.SequentialAccess)
                While reader.Read()
                    Dim buffer As Byte() = New Byte(8040) {}
                    ' Read chunks of 1KB
                    Dim bytesRead As Long = 0
                    Dim dataIndex As Long = 0
                    Do
                        'read next chunk
                        bytesRead = reader.GetBytes(0, dataIndex, buffer, 0, buffer.Length)
                        If bytesRead > 0 Then
                            'advance index
                            dataIndex += bytesRead

                            'if this is the first chunk, get the mime type from it.
                            If Not bolGotContentType Then
                                Response.ContentType = "application/octet-stream" 'getMimeFromFile(buffer)
                                bolGotContentType = True
                            End If

                            Response.BinaryWrite(buffer)
                            Response.Flush()
                        End If
                    Loop Until bytesRead = 0

                End While

            End Using
        End Using
    End Using


End Sub
我的标题如下:
Cache-Control: private
Date: Mon, 24 Jan 2011 20:37:33 GMT

Content-Length: 3153269
Content-Type: application/octet-stream

Content-Disposition: attachment;filename="C:UsersCBARTHAppDataLocalTemptmp4BC8.mdmp.gz";size=3153169
Server: Microsoft-IIS/6.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET

Content-Encoding: gzip
    
已邀请:
我建议在HTTP跟踪工具中检查实际响应(想到Firefox LiveHTTP标题),并检查是否有一些奇怪的Content-Length正在进行(多次设置?)     

要回复问题请先登录注册