0

When I return for example a pdf from my controller, my application pool spikes up, if I download the file 10 times, my app pool crashes, is there any way to clear the memory after sending the file?

I Used

 return File(ByteArrayOfFile, "application/pdf","Report");

Or

 Response.Clear();
            Response.ClearHeaders();
            Response.ClearContent();
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition",
                               string.Format("attachment; filename=" + " " +
                                             DateTime.Now.ToShortDateString() + ".pdf"));
            Response.BinaryWrite(contents);

But my app spool still spikes when I download the file

iBoonZ
  • 945
  • 10
  • 20
  • Take a look at http://stackoverflow.com/a/6875137/254973 which shows you how to "stream" a file instead of loading the entire file into memory then serving it. – Steven V Oct 01 '13 at 20:00
  • Hi I tried this, but I still get the spike, the file is only 200 kb, its a pdf with 80 pages or something. If i go to another page, and do some queries, the app pool is being collected, but if i open 6 browsers and download the file on each browser, my app pool goes banana – iBoonZ Oct 01 '13 at 21:25
  • Are you generating this file on the server as well? Or just serving a file download? – Steven V Oct 02 '13 at 13:05

0 Answers0