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);
You may want to try Response.TransmitFile method, which does not buffer the content in server memory.
精彩评论