fro*_*sty 3 asp.net memory-management
我有一个带有以下代码的ashx处理程序.我们的想法是隐藏文件的路径并提示下载
context.Response.Clear();
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
context.Response.AddHeader("Content-Length", file.Length.ToString());
context.Response.ContentType = "application/octet-stream";
context.Response.WriteFile(file.FullName);
Run Code Online (Sandbox Code Playgroud)
这适用于某些文件,但在其他人我得到
抛出了类型'System.OutOfMemoryException'的异常.
非常奇怪,7Mb非常小.也许您的应用程序池有一个下限?
如果您只需要文件下载处理程序,请使用HttpResponse.TransmitFile(),它不会将文件缓冲在内存中.
http://msdn.microsoft.com/en-us/library/12s31dhy%28VS.80%29.aspx
归档时间: |
|
查看次数: |
3069 次 |
最近记录: |