【发布时间】:2011-07-20 20:09:38
【问题描述】:
我有一个 ashx 处理程序,它获取我们正在使用的文件,这个在 SharePoint 中,然后它检查它是什么类型的文件,然后它使用 Response.BinaryWrite 写入。它从另一台服务器获取此文件,其中包含我们所有的文件。当我去下载一个像 3MB 这样的文件时,它工作正常。但是当我去下载一个 30MB 或 40MB 的文件时,我得到了错误。
Exception of type 'System.OutOfMemoryException' was thrown. at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
我检查了我的应用程序池,我们将虚拟内存设置为 1.5GB,实际内存设置为 1GB。我没有想法,不知道下一步该去哪里。有人有什么想法吗?
case "PDF":
context.Response.ContentType = "application/pdf";
context.Response.AddHeader("content-disposition", "inline; filename=" + asset.A_Name);
}
context.Response.BinaryWrite(content);
【问题讨论】:
-
您是否尝试在接收服务器的 web.Config 中增加最大文件大小?
-
你好。你是怎么做这个处理程序的?我正在尝试按照这篇文章here 做一项工作,但它根本不起作用。
标签: c# asp.net sharepoint handler binarywriter