SharePoint ashx 处理程序文件下载问题
我有一个 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);
I have a ashx handler that gets a file we are using, this in SharePoint, and then it checks what kind of file it is and then it writes using Response.BinaryWrite
. It get this file from another server, that contains all of our files. When I go to download a file thats like 3MB it works fine. But when I go to download a 30MB or 40MB file I get the error.
Exception of type 'System.OutOfMemoryException' was thrown. at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
I checked my Application Pool at we have it set at 1.5GB for Virtual and 1GB for actual memory. I am out of ideas and dont know where to go next does anyone have any ideas?
case "PDF":
context.Response.ContentType = "application/pdf";
context.Response.AddHeader("content-disposition", "inline; filename=" + asset.A_Name);
}
context.Response.BinaryWrite(content);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想尝试 Response.TransmitFile 方法,该方法不会在服务器内存中缓冲内容。
You may want to try Response.TransmitFile method, which does not buffer the content in server memory.