Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Server has not enough memory for operation (Some .rpt files not removing from Temp folder )

We have web application developed in ASP.NET 4.0 ftramework and published on IIS. And we are using 13_0_8 version of CR.


I am creating report files and exporting these as pdf. And I am disposing streams and report documents at the end. Initially, there wasn't any problem and temporary files which are created by CrystalReport were deleting all. But, now requests to the web application increeased to about 50.000 in a day and now some .rpt files are staying in Temp folder and I can't delete them. After recycling application pool all files are removed by IIS. Then, after 1 or 2 hours new .rpt files are creating in Temp folder. And after somewhile, application throws Server has not enough memory for operation. And, IMHO the reason is temp files. Here is the code I am using to export report as pdf.


Questions:

1. Is the reason of this exception is temp files in Temp folder?

2. What is wrong in that code?


ReportDocument report = DownloadPDF.GetReport(id);

  
MemoryStream stream = (MemoryStream)report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
  
Response.ContentType = "application/pdf";
  
Response.AddHeader("content-disposition", "attachment; filename=" + id+ ".pdf");

  report
.Close();
  report
.Dispose();
  
try
  
{
  
Response.BinaryWrite(stream.ToArray());
  
Response.End();
  
}
  
catch (Exception)
  
{

  
}
  
finally
  
{
  stream
.Flush();
  stream
.Close();
  stream
.Dispose();
  
}



Here is the StackTrace


Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question