用ie的下载:一会就出现了:“与服务器的连接重置” 窗口,下载断掉了。
之后系统在本地区 就一段时间访问不了了。
用迅雷下载:可以下载完 ,但是下载下来的文件 打开不了,同样一段时间访问不了系统。
服务器上的excel文件都是正常没问题的文件。

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/5148/5148170.xml?temp=2.819461E-02
      

  2.   

    使用连接方式下载,你的iis会吃不消的,内存暴涨,特别是当文件比较大时。给你个方法,调用它,限制每次发送数据的大小:ret为虚拟目录,DownloadFileName为文件名string pathname=Server.MapPath(ret)+DownloadFileName; System.IO.Stream iStream = null; // Buffer to read 10K bytes in chunk:
    byte[] buffer = new Byte[1048576]; // Length of the file:
    int length; // Total bytes to read:
    long dataToRead; try
    {
    // Open the file.
    iStream = new System.IO.FileStream(pathname, System.IO.FileMode.Open, 
    System.IO.FileAccess.Read,System.IO.FileShare.Read);
    // Total bytes to read:
    dataToRead = iStream.Length; Response.ContentType = "application/x-msdownload";
    Response.AddHeader("Content-Disposition", "attachment; filename=" + DownloadFileName); // Read the bytes.
    while (dataToRead > 0)
    {
    // Verify that the client is connected.
    if (Response.IsClientConnected) 
    {
    // Read the data in buffer.
    length = iStream.Read(buffer, 0, 1048576); // Write the data to the current output stream.
    Response.OutputStream.Write(buffer, 0, length); // Flush the data to the HTML output.
    Response.Flush(); buffer= new Byte[1048576];
    dataToRead = dataToRead - length;
    }
    else
    {
    //prevent infinite loop if user disconnects
    dataToRead = -1;
    }
    }
    }
    catch (Exception ex) 
    {
    throw ex;
    }
    finally
    {
    if (iStream != null) 
    {
    //Close the file.
    iStream.Close();
    }
    }
      

  3.   

    Respons.Clear();
    Respons.TransmitFile(path);
    直接传输文件到客户端,很少占用服务器内存,不用缓存,据说可传2GB的文件,缺点不支持断点续传。
      

  4.   

    to peng_0_0_1983(这头猪很瘦) :
    还是会出现 “与服务器的连接被重置” 的问题。  
    接着就有一段时间http访问不了系统了(这个问题可能是电信的) ,但是ping命令可以ping 通 。