很奇怪的问题 在vs2008中测试下载速度没问题 但是一部署到IIS上就变得慢的不行
在VS2008中调试的时候下载两秒的东西 到IIS上得2分钟
下载方式是普通的流方式下载
是不是IIS需要配置什么东西 知道的帮忙回答下

解决方案 »

  1.   

    确定没有病毒吗?IIS不用80端口试试
      

  2.   

    VS只运行一个IIS上就不清楚多少了...查看任务管理器 看看CPU占用实在不行:重装IIS看看最后出绝招:重装系统
      

  3.   


            public string GetFiles(string fileNamef)
            {
                string strFileName = string.Empty;
                string strFilePath = string.Empty;
                string result = string.Empty;
                strFilePath = fileNamef;
                strFileName = fileNamef.Substring(fileNamef.LastIndexOf('\\') + 1, fileNamef.Length - (fileNamef.LastIndexOf('\\') + 1));            if (System.IO.File.Exists(strFilePath) == false)
                {
                    result = "文件不存在,请重新核对文件名。";
                }
                else
                {                //以流方式下载文件
                    long intFileSize = 0;
                    FileStream fs = new FileStream(strFilePath, FileMode.Open,FileAccess.Read);
                    intFileSize = fs.Length;
                    byte[] bytes = new byte[(int)intFileSize];
                    fs.Read(bytes, 0, bytes.Length);
                    fs.Close();                HttpContext.Current.Response.ContentType = "application/octet-stream";
                    HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8));
                    HttpContext.Current.Response.AddHeader("Content-Length", intFileSize.ToString());
                    HttpContext.Current.Response.Charset = "UTF-8";
                    HttpContext.Current.Response.BinaryWrite(bytes);
                    HttpContext.Current.Response.Flush();
                    HttpContext.Current.Response.End();
                }            return result;
            }
      

  4.   


    你的所谓IIS跟你调试时是在同一台机器上吗?这个不可不说明白!
      

  5.   

    这个是个问题,此外在VS中是调试环境,在IIS中运行环境,为了保障其它用户的正常浏览,一般都会对单个浏览用户的数据量做些限制,很正常。