.NET文件下载慢的问题 知道的过来看看 很奇怪的问题 在vs2008中测试下载速度没问题 但是一部署到IIS上就变得慢的不行在VS2008中调试的时候下载两秒的东西 到IIS上得2分钟下载方式是普通的流方式下载是不是IIS需要配置什么东西 知道的帮忙回答下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 确定没有病毒吗?IIS不用80端口试试 VS只运行一个IIS上就不清楚多少了...查看任务管理器 看看CPU占用实在不行:重装IIS看看最后出绝招:重装系统 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; } 你的所谓IIS跟你调试时是在同一台机器上吗?这个不可不说明白! 这个是个问题,此外在VS中是调试环境,在IIS中运行环境,为了保障其它用户的正常浏览,一般都会对单个浏览用户的数据量做些限制,很正常。 数据库筛选非listbox中数据的问题 关于C# asp.net 验证问题 急,各位仁兄帮帮忙 asp.net 站点跑不起来 斑主在吗?我想问一你一个问题? 如何实现类的实例化?? 两DropDownLisi控件怎么关联 一个显示省份 一个显示市级! 帮忙看看这个代码有没有问题!总觉得有问题! 如何实现数据库表与XML中的数据传送? DataGrid中DataRowView一个貌似简单的问题,请大家解决一下,不胜感激!。 javascript 报错 permission denied 怎样在.net中实现换皮肤呢?
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;
}
你的所谓IIS跟你调试时是在同一台机器上吗?这个不可不说明白!